home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / winsock2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  91.8 KB  |  3,602 lines

  1. /* Winsock2.h -- definitions to be used with the WinSock 2 DLL and
  2.  *               WinSock 2 applications.
  3.  *
  4.  * This header file corresponds to version 2.2.x of the WinSock API
  5.  * specification.
  6.  *
  7.  * This file includes parts which are Copyright (c) 1982-1986 Regents
  8.  * of the University of California.  All rights reserved.  The
  9.  * Berkeley Software License Agreement specifies the terms and
  10.  * conditions for redistribution.
  11.  */
  12.  
  13. #ifndef _WINSOCK2API_
  14. #define _WINSOCK2API_
  15. #define _WINSOCKAPI_   /* Prevent inclusion of winsock.h in windows.h */
  16. #pragma option push -b
  17.  
  18. /*
  19.  * Ensure structures are packed consistently.
  20.  */
  21.  
  22. #include <pshpack4.h>
  23.  
  24. /*
  25.  * Default: include function prototypes, don't include function typedefs.
  26.  */
  27.  
  28. #ifndef INCL_WINSOCK_API_PROTOTYPES
  29. #define INCL_WINSOCK_API_PROTOTYPES 1
  30. #endif
  31.  
  32. #ifndef INCL_WINSOCK_API_TYPEDEFS
  33. #define INCL_WINSOCK_API_TYPEDEFS 0
  34. #endif
  35.  
  36. /*
  37.  * Pull in WINDOWS.H if necessary
  38.  */
  39. #ifndef _INC_WINDOWS
  40.  
  41. #include <windows.h>
  42.  
  43. #endif /* _INC_WINDOWS */
  44.  
  45. /*
  46.  * Establish DLL function linkage if supported by the current build
  47.  * environment and not previously defined.
  48.  */
  49.  
  50. #ifndef WINSOCK_API_LINKAGE
  51. #ifdef DECLSPEC_IMPORT
  52. #define WINSOCK_API_LINKAGE DECLSPEC_IMPORT
  53. #else
  54. #define WINSOCK_API_LINKAGE
  55. #endif
  56. #endif
  57.  
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif
  61.  
  62. /*
  63.  * Basic system type definitions, taken from the BSD file sys/types.h.
  64.  */
  65. typedef unsigned char   u_char;
  66. typedef unsigned short  u_short;
  67. typedef unsigned int    u_int;
  68. typedef unsigned long   u_long;
  69.  
  70. /*
  71.  * The new type to be used in all
  72.  * instances which refer to sockets.
  73.  */
  74. typedef u_int           SOCKET;
  75.  
  76. /*
  77.  * Select uses arrays of SOCKETs.  These macros manipulate such
  78.  * arrays.  FD_SETSIZE may be defined by the user before including
  79.  * this file, but the default here should be >= 64.
  80.  *
  81.  * CAVEAT IMPLEMENTOR and USER: THESE MACROS AND TYPES MUST BE
  82.  * INCLUDED IN WINSOCK2.H EXACTLY AS SHOWN HERE.
  83.  */
  84. #ifndef FD_SETSIZE
  85. #define FD_SETSIZE      64
  86. #endif /* FD_SETSIZE */
  87.  
  88. typedef struct fd_set {
  89.         u_int fd_count;               /* how many are SET? */
  90.         SOCKET  fd_array[FD_SETSIZE];   /* an array of SOCKETs */
  91. } fd_set;
  92.  
  93. extern int PASCAL FAR __WSAFDIsSet(SOCKET, fd_set FAR *);
  94.  
  95. #define FD_CLR(fd, set) do { \
  96.     u_int __i; \
  97.     for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count ; __i++) { \
  98.         if (((fd_set FAR *)(set))->fd_array[__i] == fd) { \
  99.             while (__i < ((fd_set FAR *)(set))->fd_count-1) { \
  100.                 ((fd_set FAR *)(set))->fd_array[__i] = \
  101.                     ((fd_set FAR *)(set))->fd_array[__i+1]; \
  102.                 __i++; \
  103.             } \
  104.             ((fd_set FAR *)(set))->fd_count--; \
  105.             break; \
  106.         } \
  107.     } \
  108. } while(0)
  109.  
  110. #define FD_SET(fd, set) do { \
  111.     u_int __i; \
  112.     for (__i = 0; __i < ((fd_set FAR *)(set))->fd_count; __i++) { \
  113.         if (((fd_set FAR *)(set))->fd_array[__i] == (fd)) { \
  114.             break; \
  115.         } \
  116.     } \
  117.     if (__i == ((fd_set FAR *)(set))->fd_count) { \
  118.         if (((fd_set FAR *)(set))->fd_count < FD_SETSIZE) { \
  119.             ((fd_set FAR *)(set))->fd_array[__i] = (fd); \
  120.             ((fd_set FAR *)(set))->fd_count++; \
  121.         } \
  122.     } \
  123. } while(0)
  124.  
  125. #define FD_ZERO(set) (((fd_set FAR *)(set))->fd_count=0)
  126.  
  127. #define FD_ISSET(fd, set) __WSAFDIsSet((SOCKET)(fd), (fd_set FAR *)(set))
  128.  
  129. /*
  130.  * Structure used in select() call, taken from the BSD file sys/time.h.
  131.  */
  132. struct timeval {
  133.         long    tv_sec;         /* seconds */
  134.         long    tv_usec;        /* and microseconds */
  135. };
  136.  
  137. /*
  138.  * Operations on timevals.
  139.  *
  140.  * NB: timercmp does not work for >= or <=.
  141.  */
  142. #define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
  143. #define timercmp(tvp, uvp, cmp) \
  144.         ((tvp)->tv_sec cmp (uvp)->tv_sec || \
  145.          (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
  146. #define timerclear(tvp)         (tvp)->tv_sec = (tvp)->tv_usec = 0
  147.  
  148. /*
  149.  * Commands for ioctlsocket(),  taken from the BSD file fcntl.h.
  150.  *
  151.  *
  152.  * Ioctl's have the command encoded in the lower word,
  153.  * and the size of any in or out parameters in the upper
  154.  * word.  The high 2 bits of the upper word are used
  155.  * to encode the in/out status of the parameter; for now
  156.  * we restrict parameters to at most 128 bytes.
  157.  */
  158. #define IOCPARM_MASK    0x7f            /* parameters must be < 128 bytes */
  159. #define IOC_VOID        0x20000000      /* no parameters */
  160. #define IOC_OUT         0x40000000      /* copy out parameters */
  161. #define IOC_IN          0x80000000      /* copy in parameters */
  162. #define IOC_INOUT       (IOC_IN|IOC_OUT)
  163.                                         /* 0x20000000 distinguishes new &
  164.                                            old ioctl's */
  165. #define _IO(x,y)        (IOC_VOID|((x)<<8)|(y))
  166.  
  167. #define _IOR(x,y,t)     (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
  168.  
  169. #define _IOW(x,y,t)     (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
  170.  
  171. #define FIONREAD    _IOR('f', 127, u_long) /* get # bytes to read */
  172. #define FIONBIO     _IOW('f', 126, u_long) /* set/clear non-blocking i/o */
  173. #define FIOASYNC    _IOW('f', 125, u_long) /* set/clear async i/o */
  174.  
  175. /* Socket I/O Controls */
  176. #define SIOCSHIWAT  _IOW('s',  0, u_long)  /* set high watermark */
  177. #define SIOCGHIWAT  _IOR('s',  1, u_long)  /* get high watermark */
  178. #define SIOCSLOWAT  _IOW('s',  2, u_long)  /* set low watermark */
  179. #define SIOCGLOWAT  _IOR('s',  3, u_long)  /* get low watermark */
  180. #define SIOCATMARK  _IOR('s',  7, u_long)  /* at oob mark? */
  181.  
  182. /*
  183.  * Structures returned by network data base library, taken from the
  184.  * BSD file netdb.h.  All addresses are supplied in host order, and
  185.  * returned in network order (suitable for use in system calls).
  186.  */
  187.  
  188. struct  hostent {
  189.         char    FAR * h_name;           /* official name of host */
  190.         char    FAR * FAR * h_aliases;  /* alias list */
  191.         short   h_addrtype;             /* host address type */
  192.         short   h_length;               /* length of address */
  193.         char    FAR * FAR * h_addr_list; /* list of addresses */
  194. #define h_addr  h_addr_list[0]          /* address, for backward compat */
  195. };
  196.  
  197. /*
  198.  * It is assumed here that a network number
  199.  * fits in 32 bits.
  200.  */
  201. struct  netent {
  202.         char    FAR * n_name;           /* official name of net */
  203.         char    FAR * FAR * n_aliases;  /* alias list */
  204.         short   n_addrtype;             /* net address type */
  205.         u_long  n_net;                  /* network # */
  206. };
  207.  
  208. struct  servent {
  209.         char    FAR * s_name;           /* official service name */
  210.         char    FAR * FAR * s_aliases;  /* alias list */
  211.         short   s_port;                 /* port # */
  212.         char    FAR * s_proto;          /* protocol to use */
  213. };
  214.  
  215. struct  protoent {
  216.         char    FAR * p_name;           /* official protocol name */
  217.         char    FAR * FAR * p_aliases;  /* alias list */
  218.         short   p_proto;                /* protocol # */
  219. };
  220.  
  221. /*
  222.  * Constants and structures defined by the internet system,
  223.  * Per RFC 790, September 1981, taken from the BSD file netinet/in.h.
  224.  */
  225.  
  226. /*
  227.  * Protocols
  228.  */
  229. #define IPPROTO_IP              0               /* dummy for IP */
  230. #define IPPROTO_ICMP            1               /* control message protocol */
  231. #define IPPROTO_IGMP            2               /* internet group management protocol */
  232. #define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
  233. #define IPPROTO_TCP             6               /* tcp */
  234. #define IPPROTO_PUP             12              /* pup */
  235. #define IPPROTO_UDP             17              /* user datagram protocol */
  236. #define IPPROTO_IDP             22              /* xns idp */
  237. #define IPPROTO_ND              77              /* UNOFFICIAL net disk proto */
  238.  
  239. #define IPPROTO_RAW             255             /* raw IP packet */
  240. #define IPPROTO_MAX             256
  241.  
  242. /*
  243.  * Port/socket numbers: network standard functions
  244.  */
  245. #define IPPORT_ECHO             7
  246. #define IPPORT_DISCARD          9
  247. #define IPPORT_SYSTAT           11
  248. #define IPPORT_DAYTIME          13
  249. #define IPPORT_NETSTAT          15
  250. #define IPPORT_FTP              21
  251. #define IPPORT_TELNET           23
  252. #define IPPORT_SMTP             25
  253. #define IPPORT_TIMESERVER       37
  254. #define IPPORT_NAMESERVER       42
  255. #define IPPORT_WHOIS            43
  256. #define IPPORT_MTP              57
  257.  
  258. /*
  259.  * Port/socket numbers: host specific functions
  260.  */
  261. #define IPPORT_TFTP             69
  262. #define IPPORT_RJE              77
  263. #define IPPORT_FINGER           79
  264. #define IPPORT_TTYLINK          87
  265. #define IPPORT_SUPDUP           95
  266.  
  267. /*
  268.  * UNIX TCP sockets
  269.  */
  270. #define IPPORT_EXECSERVER       512
  271. #define IPPORT_LOGINSERVER      513
  272. #define IPPORT_CMDSERVER        514
  273. #define IPPORT_EFSSERVER        520
  274.  
  275. /*
  276.  * UNIX UDP sockets
  277.  */
  278. #define IPPORT_BIFFUDP          512
  279. #define IPPORT_WHOSERVER        513
  280. #define IPPORT_ROUTESERVER      520
  281.                                         /* 520+1 also used */
  282.  
  283. /*
  284.  * Ports < IPPORT_RESERVED are reserved for
  285.  * privileged processes (e.g. root).
  286.  */
  287. #define IPPORT_RESERVED         1024
  288.  
  289. /*
  290.  * Link numbers
  291.  */
  292. #define IMPLINK_IP              155
  293. #define IMPLINK_LOWEXPER        156
  294. #define IMPLINK_HIGHEXPER       158
  295.  
  296. /*
  297.  * Internet address (old style... should be updated)
  298.  */
  299. struct in_addr {
  300.         union {
  301.                 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
  302.                 struct { u_short s_w1,s_w2; } S_un_w;
  303.                 u_long S_addr;
  304.         } S_un;
  305. #define s_addr  S_un.S_addr
  306.                                 /* can be used for most tcp & ip code */
  307. #define s_host  S_un.S_un_b.s_b2
  308.                                 /* host on imp */
  309. #define s_net   S_un.S_un_b.s_b1
  310.                                 /* network */
  311. #define s_imp   S_un.S_un_w.s_w2
  312.                                 /* imp */
  313. #define s_impno S_un.S_un_b.s_b4
  314.                                 /* imp # */
  315. #define s_lh    S_un.S_un_b.s_b3
  316.                                 /* logical host */
  317. };
  318.  
  319. /*
  320.  * Definitions of bits in internet address integers.
  321.  * On subnets, the decomposition of addresses to host and net parts
  322.  * is done according to subnet mask, not the masks here.
  323.  */
  324. #define IN_CLASSA(i)            (((long)(i) & 0x80000000) == 0)
  325. #define IN_CLASSA_NET           0xff000000
  326. #define IN_CLASSA_NSHIFT        24
  327. #define IN_CLASSA_HOST          0x00ffffff
  328. #define IN_CLASSA_MAX           128
  329.  
  330. #define IN_CLASSB(i)            (((long)(i) & 0xc0000000) == 0x80000000)
  331. #define IN_CLASSB_NET           0xffff0000
  332. #define IN_CLASSB_NSHIFT        16
  333. #define IN_CLASSB_HOST          0x0000ffff
  334. #define IN_CLASSB_MAX           65536
  335.  
  336. #define IN_CLASSC(i)            (((long)(i) & 0xe0000000) == 0xc0000000)
  337. #define IN_CLASSC_NET           0xffffff00
  338. #define IN_CLASSC_NSHIFT        8
  339. #define IN_CLASSC_HOST          0x000000ff
  340.  
  341. #define IN_CLASSD(i)            (((long)(i) & 0xf0000000) == 0xe0000000)
  342. #define IN_CLASSD_NET           0xf0000000       /* These ones aren't really */
  343. #define IN_CLASSD_NSHIFT        28               /* net and host fields, but */
  344. #define IN_CLASSD_HOST          0x0fffffff       /* routing needn't know.    */
  345. #define IN_MULTICAST(i)         IN_CLASSD(i)
  346.  
  347. #define INADDR_ANY              (u_long)0x00000000
  348. #define INADDR_LOOPBACK         0x7f000001
  349. #define INADDR_BROADCAST        (u_long)0xffffffff
  350. #define INADDR_NONE             0xffffffff
  351.  
  352. #define ADDR_ANY                INADDR_ANY
  353.  
  354. /*
  355.  * Socket address, internet style.
  356.  */
  357. struct sockaddr_in {
  358.         short   sin_family;
  359.         u_short sin_port;
  360.         struct  in_addr sin_addr;
  361.         char    sin_zero[8];
  362. };
  363.  
  364. #define WSADESCRIPTION_LEN      256
  365. #define WSASYS_STATUS_LEN       128
  366.  
  367. typedef struct WSAData {
  368.         WORD                    wVersion;
  369.         WORD                    wHighVersion;
  370.         char                    szDescription[WSADESCRIPTION_LEN+1];
  371.         char                    szSystemStatus[WSASYS_STATUS_LEN+1];
  372.         unsigned short          iMaxSockets;
  373.         unsigned short          iMaxUdpDg;
  374.         char FAR *              lpVendorInfo;
  375. } WSADATA, FAR * LPWSADATA;
  376.  
  377. #if !defined(MAKEWORD)
  378. #define MAKEWORD(low,high) \
  379.         ((WORD)((BYTE)(low)) | (((WORD)(BYTE)(high))<<8)))
  380. #endif
  381.  
  382. /*
  383.  * Definitions related to sockets: types, address families, options,
  384.  * taken from the BSD file sys/socket.h.
  385.  */
  386.  
  387. /*
  388.  * This is used instead of -1, since the
  389.  * SOCKET type is unsigned.
  390.  */
  391. #define INVALID_SOCKET  (SOCKET)(~0)
  392. #define SOCKET_ERROR            (-1)
  393.  
  394. /*
  395.  * The  following  may  be used in place of the address family, socket type, or
  396.  * protocol  in  a  call  to WSASocket to indicate that the corresponding value
  397.  * should  be taken from the supplied WSAPROTOCOL_INFO structure instead of the
  398.  * parameter itself.
  399.  */
  400. #define FROM_PROTOCOL_INFO (-1)
  401.  
  402. /*
  403.  * Types
  404.  */
  405. #define SOCK_STREAM     1               /* stream socket */
  406. #define SOCK_DGRAM      2               /* datagram socket */
  407. #define SOCK_RAW        3               /* raw-protocol interface */
  408. #define SOCK_RDM        4               /* reliably-delivered message */
  409. #define SOCK_SEQPACKET  5               /* sequenced packet stream */
  410.  
  411. /*
  412.  * Option flags per-socket.
  413.  */
  414. #define SO_DEBUG        0x0001          /* turn on debugging info recording */
  415. #define SO_ACCEPTCONN   0x0002          /* socket has had listen() */
  416. #define SO_REUSEADDR    0x0004          /* allow local address reuse */
  417. #define SO_KEEPALIVE    0x0008          /* keep connections alive */
  418. #define SO_DONTROUTE    0x0010          /* just use interface addresses */
  419. #define SO_BROADCAST    0x0020          /* permit sending of broadcast msgs */
  420. #define SO_USELOOPBACK  0x0040          /* bypass hardware when possible */
  421. #define SO_LINGER       0x0080          /* linger on close if data present */
  422. #define SO_OOBINLINE    0x0100          /* leave received OOB data in line */
  423.  
  424. #define SO_DONTLINGER   (int)(~SO_LINGER)
  425.  
  426. /*
  427.  * Additional options.
  428.  */
  429. #define SO_SNDBUF       0x1001          /* send buffer size */
  430. #define SO_RCVBUF       0x1002          /* receive buffer size */
  431. #define SO_SNDLOWAT     0x1003          /* send low-water mark */
  432. #define SO_RCVLOWAT     0x1004          /* receive low-water mark */
  433. #define SO_SNDTIMEO     0x1005          /* send timeout */
  434. #define SO_RCVTIMEO     0x1006          /* receive timeout */
  435. #define SO_ERROR        0x1007          /* get error status and clear */
  436. #define SO_TYPE         0x1008          /* get socket type */
  437.  
  438. /*
  439.  * WinSock 2 extension -- new options
  440.  */
  441. #define SO_GROUP_ID       0x2001      /* ID of a socket group */
  442. #define SO_GROUP_PRIORITY 0x2002      /* the relative priority within a group*/
  443. #define SO_MAX_MSG_SIZE   0x2003      /* maximum message size */
  444. #define SO_PROTOCOL_INFOA 0x2004      /* WSAPROTOCOL_INFOA structure */
  445. #define SO_PROTOCOL_INFOW 0x2005      /* WSAPROTOCOL_INFOW structure */
  446. #ifdef UNICODE
  447. #define SO_PROTOCOL_INFO  SO_PROTOCOL_INFOW
  448. #else
  449. #define SO_PROTOCOL_INFO  SO_PROTOCOL_INFOA
  450. #endif /* UNICODE */
  451. #define PVD_CONFIG        0x3001          /* configuration info for service provider */
  452.  
  453. /*
  454.  * TCP options.
  455.  */
  456. #define TCP_NODELAY     0x0001
  457.  
  458. /*
  459.  * Address families.
  460.  */
  461. #define AF_UNSPEC       0               /* unspecified */
  462. /*
  463.  * Although  AF_UNSPEC  is  defined for backwards compatibility, using
  464.  * AF_UNSPEC for the "af" parameter when creating a socket is STRONGLY
  465.  * DISCOURAGED.    The  interpretation  of  the  "protocol"  parameter
  466.  * depends  on the actual address family chosen.  As environments grow
  467.  * to  include  more  and  more  address families that use overlapping
  468.  * protocol  values  there  is  more  and  more  chance of choosing an
  469.  * undesired address family when AF_UNSPEC is used.
  470.  */
  471. #define AF_UNIX         1               /* local to host (pipes, portals) */
  472. #define AF_INET         2               /* internetwork: UDP, TCP, etc. */
  473. #define AF_IMPLINK      3               /* arpanet imp addresses */
  474. #define AF_PUP          4               /* pup protocols: e.g. BSP */
  475. #define AF_CHAOS        5               /* mit CHAOS protocols */
  476. #define AF_NS           6               /* XEROX NS protocols */
  477. #define AF_IPX          AF_NS           /* IPX protocols: IPX, SPX, etc. */
  478. #define AF_ISO          7               /* ISO protocols */
  479. #define AF_OSI          AF_ISO          /* OSI is ISO */
  480. #define AF_ECMA         8               /* european computer manufacturers */
  481. #define AF_DATAKIT      9               /* datakit protocols */
  482. #define AF_CCITT        10              /* CCITT protocols, X.25 etc */
  483. #define AF_SNA          11              /* IBM SNA */
  484. #define AF_DECnet       12              /* DECnet */
  485. #define AF_DLI          13              /* Direct data link interface */
  486. #define AF_LAT          14              /* LAT */
  487. #define AF_HYLINK       15              /* NSC Hyperchannel */
  488. #define AF_APPLETALK    16              /* AppleTalk */
  489. #define AF_NETBIOS      17              /* NetBios-style addresses */
  490. #define AF_VOICEVIEW    18              /* VoiceView */
  491. #define AF_FIREFOX      19              /* Protocols from Firefox */
  492. #define AF_UNKNOWN1     20              /* Somebody is using this! */
  493. #define AF_BAN          21              /* Banyan */
  494. #define AF_ATM          22              /* Native ATM Services */
  495. #define AF_INET6        23              /* Internetwork Version 6 */
  496.  
  497. #define AF_MAX          24
  498.  
  499. /*
  500.  * Structure used by kernel to store most
  501.  * addresses.
  502.  */
  503. struct sockaddr {
  504.         u_short sa_family;              /* address family */
  505.         char    sa_data[14];            /* up to 14 bytes of direct address */
  506. };
  507.  
  508. /*
  509.  * Structure used by kernel to pass protocol
  510.  * information in raw sockets.
  511.  */
  512. struct sockproto {
  513.         u_short sp_family;              /* address family */
  514.         u_short sp_protocol;            /* protocol */
  515. };
  516.  
  517. /*
  518.  * Protocol families, same as address families for now.
  519.  */
  520. #define PF_UNSPEC       AF_UNSPEC
  521. #define PF_UNIX         AF_UNIX
  522. #define PF_INET         AF_INET
  523. #define PF_IMPLINK      AF_IMPLINK
  524. #define PF_PUP          AF_PUP
  525. #define PF_CHAOS        AF_CHAOS
  526. #define PF_NS           AF_NS
  527. #define PF_IPX          AF_IPX
  528. #define PF_ISO          AF_ISO
  529. #define PF_OSI          AF_OSI
  530. #define PF_ECMA         AF_ECMA
  531. #define PF_DATAKIT      AF_DATAKIT
  532. #define PF_CCITT        AF_CCITT
  533. #define PF_SNA          AF_SNA
  534. #define PF_DECnet       AF_DECnet
  535. #define PF_DLI          AF_DLI
  536. #define PF_LAT          AF_LAT
  537. #define PF_HYLINK       AF_HYLINK
  538. #define PF_APPLETALK    AF_APPLETALK
  539. #define PF_VOICEVIEW    AF_VOICEVIEW
  540. #define PF_FIREFOX      AF_FIREFOX
  541. #define PF_UNKNOWN1     AF_UNKNOWN1
  542. #define PF_BAN          AF_BAN
  543. #define PF_ATM          AF_ATM
  544. #define PF_INET6        AF_INET6
  545.  
  546. #define PF_MAX          AF_MAX
  547.  
  548. /*
  549.  * Structure used for manipulating linger option.
  550.  */
  551. struct  linger {
  552.         u_short l_onoff;                /* option on/off */
  553.         u_short l_linger;               /* linger time */
  554. };
  555.  
  556. /*
  557.  * Level number for (get/set)sockopt() to apply to socket itself.
  558.  */
  559. #define SOL_SOCKET      0xffff          /* options for socket level */
  560.  
  561. /*
  562.  * Maximum queue length specifiable by listen.
  563.  */
  564. #define SOMAXCONN       0x7fffffff
  565.  
  566. #define MSG_OOB         0x1             /* process out-of-band data */
  567. #define MSG_PEEK        0x2             /* peek at incoming message */
  568. #define MSG_DONTROUTE   0x4             /* send without using routing tables */
  569.  
  570. #define MSG_PARTIAL     0x8000          /* partial send or recv for message xport */
  571.  
  572. /*
  573.  * WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and
  574.  *                          WSARecvFrom()
  575.  */
  576. #define MSG_INTERRUPT   0x10            /* send/recv in the interrupt context */
  577.  
  578. #define MSG_MAXIOVLEN   16
  579.  
  580. /*
  581.  * Define constant based on rfc883, used by gethostbyxxxx() calls.
  582.  */
  583. #define MAXGETHOSTSTRUCT        1024
  584.  
  585. /*
  586.  * WinSock 2 extension -- bit values and indices for FD_XXX network events
  587.  */
  588. #define FD_READ_BIT      0
  589. #define FD_READ          (1 << FD_READ_BIT)
  590.  
  591. #define FD_WRITE_BIT     1
  592. #define FD_WRITE         (1 << FD_WRITE_BIT)
  593.  
  594. #define FD_OOB_BIT       2
  595. #define FD_OOB           (1 << FD_OOB_BIT)
  596.  
  597. #define FD_ACCEPT_BIT    3
  598. #define FD_ACCEPT        (1 << FD_ACCEPT_BIT)
  599.  
  600. #define FD_CONNECT_BIT   4
  601. #define FD_CONNECT       (1 << FD_CONNECT_BIT)
  602.  
  603. #define FD_CLOSE_BIT     5
  604. #define FD_CLOSE         (1 << FD_CLOSE_BIT)
  605.  
  606. #define FD_QOS_BIT       6
  607. #define FD_QOS           (1 << FD_QOS_BIT)
  608.  
  609. #define FD_GROUP_QOS_BIT 7
  610. #define FD_GROUP_QOS     (1 << FD_GROUP_QOS_BIT)
  611.  
  612. #define FD_MAX_EVENTS    8
  613. #define FD_ALL_EVENTS    ((1 << FD_MAX_EVENTS) - 1)
  614.  
  615.  
  616. /*
  617.  * All Windows Sockets error constants are biased by WSABASEERR from
  618.  * the "normal"
  619.  */
  620. #define WSABASEERR              10000
  621. /*
  622.  * Windows Sockets definitions of regular Microsoft C error constants
  623.  */
  624. #define WSAEINTR                (WSABASEERR+4)
  625. #define WSAEBADF                (WSABASEERR+9)
  626. #define WSAEACCES               (WSABASEERR+13)
  627. #define WSAEFAULT               (WSABASEERR+14)
  628. #define WSAEINVAL               (WSABASEERR+22)
  629. #define WSAEMFILE               (WSABASEERR+24)
  630.  
  631. /*
  632.  * Windows Sockets definitions of regular Berkeley error constants
  633.  */
  634. #define WSAEWOULDBLOCK          (WSABASEERR+35)
  635. #define WSAEINPROGRESS          (WSABASEERR+36)
  636. #define WSAEALREADY             (WSABASEERR+37)
  637. #define WSAENOTSOCK             (WSABASEERR+38)
  638. #define WSAEDESTADDRREQ         (WSABASEERR+39)
  639. #define WSAEMSGSIZE             (WSABASEERR+40)
  640. #define WSAEPROTOTYPE           (WSABASEERR+41)
  641. #define WSAENOPROTOOPT          (WSABASEERR+42)
  642. #define WSAEPROTONOSUPPORT      (WSABASEERR+43)
  643. #define WSAESOCKTNOSUPPORT      (WSABASEERR+44)
  644. #define WSAEOPNOTSUPP           (WSABASEERR+45)
  645. #define WSAEPFNOSUPPORT         (WSABASEERR+46)
  646. #define WSAEAFNOSUPPORT         (WSABASEERR+47)
  647. #define WSAEADDRINUSE           (WSABASEERR+48)
  648. #define WSAEADDRNOTAVAIL        (WSABASEERR+49)
  649. #define WSAENETDOWN             (WSABASEERR+50)
  650. #define WSAENETUNREACH          (WSABASEERR+51)
  651. #define WSAENETRESET            (WSABASEERR+52)
  652. #define WSAECONNABORTED         (WSABASEERR+53)
  653. #define WSAECONNRESET           (WSABASEERR+54)
  654. #define WSAENOBUFS              (WSABASEERR+55)
  655. #define WSAEISCONN              (WSABASEERR+56)
  656. #define WSAENOTCONN             (WSABASEERR+57)
  657. #define WSAESHUTDOWN            (WSABASEERR+58)
  658. #define WSAETOOMANYREFS         (WSABASEERR+59)
  659. #define WSAETIMEDOUT            (WSABASEERR+60)
  660. #define WSAECONNREFUSED         (WSABASEERR+61)
  661. #define WSAELOOP                (WSABASEERR+62)
  662. #define WSAENAMETOOLONG         (WSABASEERR+63)
  663. #define WSAEHOSTDOWN            (WSABASEERR+64)
  664. #define WSAEHOSTUNREACH         (WSABASEERR+65)
  665. #define WSAENOTEMPTY            (WSABASEERR+66)
  666. #define WSAEPROCLIM             (WSABASEERR+67)
  667. #define WSAEUSERS               (WSABASEERR+68)
  668. #define WSAEDQUOT               (WSABASEERR+69)
  669. #define WSAESTALE               (WSABASEERR+70)
  670. #define WSAEREMOTE              (WSABASEERR+71)
  671.  
  672. /*
  673.  * Extended Windows Sockets error constant definitions
  674.  */
  675. #define WSASYSNOTREADY          (WSABASEERR+91)
  676. #define WSAVERNOTSUPPORTED      (WSABASEERR+92)
  677. #define WSANOTINITIALISED       (WSABASEERR+93)
  678. #define WSAEDISCON              (WSABASEERR+101)
  679. #define WSAENOMORE              (WSABASEERR+102)
  680. #define WSAECANCELLED           (WSABASEERR+103)
  681. #define WSAEINVALIDPROCTABLE    (WSABASEERR+104)
  682. #define WSAEINVALIDPROVIDER     (WSABASEERR+105)
  683. #define WSAEPROVIDERFAILEDINIT  (WSABASEERR+106)
  684. #define WSASYSCALLFAILURE       (WSABASEERR+107)
  685. #define WSASERVICE_NOT_FOUND    (WSABASEERR+108)
  686. #define WSATYPE_NOT_FOUND       (WSABASEERR+109)
  687. #define WSA_E_NO_MORE           (WSABASEERR+110)
  688. #define WSA_E_CANCELLED         (WSABASEERR+111)
  689. #define WSAEREFUSED             (WSABASEERR+112)
  690.  
  691. /*
  692.  * Error return codes from gethostbyname() and gethostbyaddr()
  693.  * (when using the resolver). Note that these errors are
  694.  * retrieved via WSAGetLastError() and must therefore follow
  695.  * the rules for avoiding clashes with error numbers from
  696.  * specific implementations or language run-time systems.
  697.  * For this reason the codes are based at WSABASEERR+1001.
  698.  * Note also that [WSA]NO_ADDRESS is defined only for
  699.  * compatibility purposes.
  700.  */
  701.  
  702. #define h_errno         WSAGetLastError()
  703.  
  704. /* Authoritative Answer: Host not found */
  705. #define WSAHOST_NOT_FOUND       (WSABASEERR+1001)
  706. #define HOST_NOT_FOUND          WSAHOST_NOT_FOUND
  707.  
  708. /* Non-Authoritative: Host not found, or SERVERFAIL */
  709. #define WSATRY_AGAIN            (WSABASEERR+1002)
  710. #define TRY_AGAIN               WSATRY_AGAIN
  711.  
  712. /* Non-recoverable errors, FORMERR, REFUSED, NOTIMP */
  713. #define WSANO_RECOVERY          (WSABASEERR+1003)
  714. #define NO_RECOVERY             WSANO_RECOVERY
  715.  
  716. /* Valid name, no data record of requested type */
  717. #define WSANO_DATA              (WSABASEERR+1004)
  718. #define NO_DATA                 WSANO_DATA
  719.  
  720. /* no address, look for MX record */
  721. #define WSANO_ADDRESS           WSANO_DATA
  722. #define NO_ADDRESS              WSANO_ADDRESS
  723.  
  724. /*
  725.  * Windows Sockets errors redefined as regular Berkeley error constants.
  726.  * These are commented out in Windows NT to avoid conflicts with errno.h.
  727.  * Use the WSA constants instead.
  728.  */
  729. #if 0
  730. #define EWOULDBLOCK             WSAEWOULDBLOCK
  731. #define EINPROGRESS             WSAEINPROGRESS
  732. #define EALREADY                WSAEALREADY
  733. #define ENOTSOCK                WSAENOTSOCK
  734. #define EDESTADDRREQ            WSAEDESTADDRREQ
  735. #define EMSGSIZE                WSAEMSGSIZE
  736. #define EPROTOTYPE              WSAEPROTOTYPE
  737. #define ENOPROTOOPT             WSAENOPROTOOPT
  738. #define EPROTONOSUPPORT         WSAEPROTONOSUPPORT
  739. #define ESOCKTNOSUPPORT         WSAESOCKTNOSUPPORT
  740. #define EOPNOTSUPP              WSAEOPNOTSUPP
  741. #define EPFNOSUPPORT            WSAEPFNOSUPPORT
  742. #define EAFNOSUPPORT            WSAEAFNOSUPPORT
  743. #define EADDRINUSE              WSAEADDRINUSE
  744. #define EADDRNOTAVAIL           WSAEADDRNOTAVAIL
  745. #define ENETDOWN                WSAENETDOWN
  746. #define ENETUNREACH             WSAENETUNREACH
  747. #define ENETRESET               WSAENETRESET
  748. #define ECONNABORTED            WSAECONNABORTED
  749. #define ECONNRESET              WSAECONNRESET
  750. #define ENOBUFS                 WSAENOBUFS
  751. #define EISCONN                 WSAEISCONN
  752. #define ENOTCONN                WSAENOTCONN
  753. #define ESHUTDOWN               WSAESHUTDOWN
  754. #define ETOOMANYREFS            WSAETOOMANYREFS
  755. #define ETIMEDOUT               WSAETIMEDOUT
  756. #define ECONNREFUSED            WSAECONNREFUSED
  757. #define ELOOP                   WSAELOOP
  758. #define ENAMETOOLONG            WSAENAMETOOLONG
  759. #define EHOSTDOWN               WSAEHOSTDOWN
  760. #define EHOSTUNREACH            WSAEHOSTUNREACH
  761. #define ENOTEMPTY               WSAENOTEMPTY
  762. #define EPROCLIM                WSAEPROCLIM
  763. #define EUSERS                  WSAEUSERS
  764. #define EDQUOT                  WSAEDQUOT
  765. #define ESTALE                  WSAESTALE
  766. #define EREMOTE                 WSAEREMOTE
  767. #endif
  768.  
  769. /*
  770.  * WinSock 2 extension -- new error codes and type definition
  771.  */
  772.  
  773. #if defined(WIN32) || defined(_WIN32)
  774.  
  775. #define WSAAPI                  FAR PASCAL
  776. #define WSAEVENT                HANDLE
  777. #define LPWSAEVENT              LPHANDLE
  778. #define WSAOVERLAPPED           OVERLAPPED
  779. typedef struct _OVERLAPPED *    LPWSAOVERLAPPED;
  780.  
  781. #define WSA_IO_PENDING          (ERROR_IO_PENDING)
  782. #define WSA_IO_INCOMPLETE       (ERROR_IO_INCOMPLETE)
  783. #define WSA_INVALID_HANDLE      (ERROR_INVALID_HANDLE)
  784. #define WSA_INVALID_PARAMETER   (ERROR_INVALID_PARAMETER)
  785. #define WSA_NOT_ENOUGH_MEMORY   (ERROR_NOT_ENOUGH_MEMORY)
  786. #define WSA_OPERATION_ABORTED   (ERROR_OPERATION_ABORTED)
  787.  
  788. #define WSA_INVALID_EVENT       ((WSAEVENT)NULL)
  789. #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
  790. #define WSA_WAIT_FAILED         ((DWORD)-1L)
  791. #define WSA_WAIT_EVENT_0        (WAIT_OBJECT_0)
  792. #define WSA_WAIT_IO_COMPLETION  (WAIT_IO_COMPLETION)
  793. #define WSA_WAIT_TIMEOUT        (WAIT_TIMEOUT)
  794. #define WSA_INFINITE            (INFINITE)
  795.  
  796. #else /* WIN16 */
  797.  
  798. #define WSAAPI                  FAR PASCAL
  799. typedef DWORD                   WSAEVENT, FAR * LPWSAEVENT;
  800.  
  801. typedef struct _WSAOVERLAPPED {
  802.     DWORD    Internal;
  803.     DWORD    InternalHigh;
  804.     DWORD    Offset;
  805.     DWORD    OffsetHigh;
  806.     WSAEVENT hEvent;
  807. } WSAOVERLAPPED, FAR * LPWSAOVERLAPPED;
  808.  
  809. #define WSA_IO_PENDING          (WSAEWOULDBLOCK)
  810. #define WSA_IO_INCOMPLETE       (WSAEWOULDBLOCK)
  811. #define WSA_INVALID_HANDLE      (WSAENOTSOCK)
  812. #define WSA_INVALID_PARAMETER   (WSAEINVAL)
  813. #define WSA_NOT_ENOUGH_MEMORY   (WSAENOBUFS)
  814. #define WSA_OPERATION_ABORTED   (WSAEINTR)
  815.  
  816. #define WSA_INVALID_EVENT       ((WSAEVENT)NULL)
  817. #define WSA_MAXIMUM_WAIT_EVENTS (MAXIMUM_WAIT_OBJECTS)
  818. #define WSA_WAIT_FAILED         ((DWORD)-1L)
  819. #define WSA_WAIT_EVENT_0        ((DWORD)0)
  820. #define WSA_WAIT_TIMEOUT        ((DWORD)0x102L)
  821. #define WSA_INFINITE            ((DWORD)-1L)
  822.  
  823. #endif  /* WIN32 */
  824.  
  825. /*
  826.  * WinSock 2 extension -- WSABUF and QOS struct
  827.  */
  828.  
  829. typedef struct _WSABUF {
  830.     u_long      len;     /* the length of the buffer */
  831.     char FAR *  buf;     /* the pointer to the buffer */
  832. } WSABUF, FAR * LPWSABUF;
  833.  
  834. typedef enum
  835. {
  836.     BestEffortService,
  837.     ControlledLoadService,
  838.     PredictiveService,
  839.     GuaranteedDelayService,
  840.     GuaranteedService
  841. } GUARANTEE;
  842.  
  843. typedef long int32;
  844.  
  845. typedef struct _flowspec
  846. {
  847.     int32        TokenRate;              /* In Bytes/sec */
  848.     int32        TokenBucketSize;        /* In Bytes */
  849.     int32        PeakBandwidth;          /* In Bytes/sec */
  850.     int32        Latency;                /* In microseconds */
  851.     int32        DelayVariation;         /* In microseconds */
  852.     GUARANTEE    LevelOfGuarantee;       /* Guaranteed, Predictive */
  853.                                          /*   or Best Effort       */
  854.     int32        CostOfCall;             /* Reserved for future use, */
  855.                                          /*   must be set to 0 now   */
  856.     int32        NetworkAvailability;    /* read-only:         */
  857.                                          /*   1 if accessible, */
  858.                                          /*   0 if not         */
  859. } FLOWSPEC, FAR * LPFLOWSPEC;
  860.  
  861. typedef struct _QualityOfService
  862. {
  863.     FLOWSPEC      SendingFlowspec;       /* the flow spec for data sending */
  864.     FLOWSPEC      ReceivingFlowspec;     /* the flow spec for data receiving */
  865.     WSABUF        ProviderSpecific;      /* additional provider specific stuff */
  866. } QOS, FAR * LPQOS;
  867.  
  868. /*
  869.  * WinSock 2 extension -- manifest constants for return values of the condition function
  870.  */
  871. #define CF_ACCEPT       0x0000
  872. #define CF_REJECT       0x0001
  873. #define CF_DEFER        0x0002
  874.  
  875. /*
  876.  * WinSock 2 extension -- manifest constants for shutdown()
  877.  */
  878. #define SD_RECEIVE      0x00
  879. #define SD_SEND         0x01
  880. #define SD_BOTH         0x02
  881.  
  882. /*
  883.  * WinSock 2 extension -- data type and manifest constants for socket groups
  884.  */
  885. typedef unsigned int             GROUP;
  886.  
  887. #define SG_UNCONSTRAINED_GROUP   0x01
  888. #define SG_CONSTRAINED_GROUP     0x02
  889.  
  890. /*
  891.  * WinSock 2 extension -- data type for WSAEnumNetworkEvents()
  892.  */
  893. typedef struct _WSANETWORKEVENTS {
  894.        long lNetworkEvents;
  895.        int iErrorCode[FD_MAX_EVENTS];
  896. } WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS;
  897.  
  898. /*
  899.  * WinSock 2 extension -- WSAPROTOCOL_INFO structure and associated
  900.  * manifest constants
  901.  */
  902.  
  903. #ifndef GUID_DEFINED
  904. #define GUID_DEFINED
  905. typedef struct _GUID
  906. {
  907.     unsigned long  Data1;
  908.     unsigned short Data2;
  909.     unsigned short Data3;
  910.     unsigned char  Data4[8];
  911. } GUID;
  912. #endif /* GUID_DEFINED */
  913.  
  914. #ifndef __LPGUID_DEFINED__
  915. #define __LPGUID_DEFINED__
  916. typedef GUID *LPGUID;
  917. #endif
  918.  
  919. #define MAX_PROTOCOL_CHAIN 7
  920.  
  921. #define BASE_PROTOCOL      1
  922. #define LAYERED_PROTOCOL   0
  923.  
  924. typedef struct _WSAPROTOCOLCHAIN {
  925.     int ChainLen;                                 /* the length of the chain,     */
  926.                                                   /* length = 0 means layered protocol, */
  927.                                                   /* length = 1 means base protocol, */
  928.                                                   /* length > 1 means protocol chain */
  929.     DWORD ChainEntries[MAX_PROTOCOL_CHAIN];       /* a list of dwCatalogEntryIds */
  930. } WSAPROTOCOLCHAIN, FAR * LPWSAPROTOCOLCHAIN;
  931.  
  932. #define WSAPROTOCOL_LEN  255
  933.  
  934. typedef struct _WSAPROTOCOL_INFOA {
  935.     DWORD dwServiceFlags1;
  936.     DWORD dwServiceFlags2;
  937.     DWORD dwServiceFlags3;
  938.     DWORD dwServiceFlags4;
  939.     DWORD dwProviderFlags;
  940.     GUID ProviderId;
  941.     DWORD dwCatalogEntryId;
  942.     WSAPROTOCOLCHAIN ProtocolChain;
  943.     int iVersion;
  944.     int iAddressFamily;
  945.     int iMaxSockAddr;
  946.     int iMinSockAddr;
  947.     int iSocketType;
  948.     int iProtocol;
  949.     int iProtocolMaxOffset;
  950.     int iNetworkByteOrder;
  951.     int iSecurityScheme;
  952.     DWORD dwMessageSize;
  953.     DWORD dwProviderReserved;
  954.     CHAR   szProtocol[WSAPROTOCOL_LEN+1];
  955. } WSAPROTOCOL_INFOA, FAR * LPWSAPROTOCOL_INFOA;
  956. typedef struct _WSAPROTOCOL_INFOW {
  957.     DWORD dwServiceFlags1;
  958.     DWORD dwServiceFlags2;
  959.     DWORD dwServiceFlags3;
  960.     DWORD dwServiceFlags4;
  961.     DWORD dwProviderFlags;
  962.     GUID ProviderId;
  963.     DWORD dwCatalogEntryId;
  964.     WSAPROTOCOLCHAIN ProtocolChain;
  965.     int iVersion;
  966.     int iAddressFamily;
  967.     int iMaxSockAddr;
  968.     int iMinSockAddr;
  969.     int iSocketType;
  970.     int iProtocol;
  971.     int iProtocolMaxOffset;
  972.     int iNetworkByteOrder;
  973.     int iSecurityScheme;
  974.     DWORD dwMessageSize;
  975.     DWORD dwProviderReserved;
  976.     WCHAR  szProtocol[WSAPROTOCOL_LEN+1];
  977. } WSAPROTOCOL_INFOW, FAR * LPWSAPROTOCOL_INFOW;
  978. #ifdef UNICODE
  979. typedef WSAPROTOCOL_INFOW WSAPROTOCOL_INFO;
  980. typedef LPWSAPROTOCOL_INFOW LPWSAPROTOCOL_INFO;
  981. #else
  982. typedef WSAPROTOCOL_INFOA WSAPROTOCOL_INFO;
  983. typedef LPWSAPROTOCOL_INFOA LPWSAPROTOCOL_INFO;
  984. #endif // UNICODE
  985.  
  986. /* Flag bit definitions for dwProviderFlags */
  987. #define PFL_MULTIPLE_PROTO_ENTRIES          0x00000001
  988. #define PFL_RECOMMENDED_PROTO_ENTRY         0x00000002
  989. #define PFL_HIDDEN                          0x00000004
  990. #define PFL_MATCHES_PROTOCOL_ZERO           0x00000008
  991.  
  992. /* Flag bit definitions for dwServiceFlags1 */
  993. #define XP1_CONNECTIONLESS                  0x00000001
  994. #define XP1_GUARANTEED_DELIVERY             0x00000002
  995. #define XP1_GUARANTEED_ORDER                0x00000004
  996. #define XP1_MESSAGE_ORIENTED                0x00000008
  997. #define XP1_PSEUDO_STREAM                   0x00000010
  998. #define XP1_GRACEFUL_CLOSE                  0x00000020
  999. #define XP1_EXPEDITED_DATA                  0x00000040
  1000. #define XP1_CONNECT_DATA                    0x00000080
  1001. #define XP1_DISCONNECT_DATA                 0x00000100
  1002. #define XP1_SUPPORT_BROADCAST               0x00000200
  1003. #define XP1_SUPPORT_MULTIPOINT              0x00000400
  1004. #define XP1_MULTIPOINT_CONTROL_PLANE        0x00000800
  1005. #define XP1_MULTIPOINT_DATA_PLANE           0x00001000
  1006. #define XP1_QOS_SUPPORTED                   0x00002000
  1007. #define XP1_INTERRUPT                       0x00004000
  1008. #define XP1_UNI_SEND                        0x00008000
  1009. #define XP1_UNI_RECV                        0x00010000
  1010. #define XP1_IFS_HANDLES                     0x00020000
  1011. #define XP1_PARTIAL_MESSAGE                 0x00040000
  1012.  
  1013. #define BIGENDIAN                           0x0000
  1014. #define LITTLEENDIAN                        0x0001
  1015.  
  1016. #define SECURITY_PROTOCOL_NONE              0x0000
  1017.  
  1018. /*
  1019.  * WinSock 2 extension -- manifest constants for WSAJoinLeaf()
  1020.  */
  1021. #define JL_SENDER_ONLY    0x01
  1022. #define JL_RECEIVER_ONLY  0x02
  1023. #define JL_BOTH           0x04
  1024.  
  1025. /*
  1026.  * WinSock 2 extension -- manifest constants for WSASocket()
  1027.  */
  1028. #define WSA_FLAG_OVERLAPPED           0x01
  1029. #define WSA_FLAG_MULTIPOINT_C_ROOT    0x02
  1030. #define WSA_FLAG_MULTIPOINT_C_LEAF    0x04
  1031. #define WSA_FLAG_MULTIPOINT_D_ROOT    0x08
  1032. #define WSA_FLAG_MULTIPOINT_D_LEAF    0x10
  1033.  
  1034. /*
  1035.  * WinSock 2 extension -- manifest constants for WSAIoctl()
  1036.  */
  1037. #define IOC_UNIX                      0x00000000
  1038. #define IOC_WS2                       0x08000000
  1039. #define IOC_PROTOCOL                  0x10000000
  1040. #define IOC_VENDOR                    0x18000000
  1041.  
  1042. #define _WSAIO(x,y)                   (IOC_VOID|(x)|(y))
  1043. #define _WSAIOR(x,y)                  (IOC_OUT|(x)|(y))
  1044. #define _WSAIOW(x,y)                  (IOC_IN|(x)|(y))
  1045. #define _WSAIORW(x,y)                 (IOC_INOUT|(x)|(y))
  1046.  
  1047. #define SIO_ASSOCIATE_HANDLE          _WSAIOW(IOC_WS2,1)
  1048. #define SIO_ENABLE_CIRCULAR_QUEUEING  _WSAIO(IOC_WS2,2)
  1049. #define SIO_FIND_ROUTE                _WSAIOR(IOC_WS2,3)
  1050. #define SIO_FLUSH                     _WSAIO(IOC_WS2,4)
  1051. #define SIO_GET_BROADCAST_ADDRESS     _WSAIOR(IOC_WS2,5)
  1052. #define SIO_GET_EXTENSION_FUNCTION_POINTER  _WSAIORW(IOC_WS2,6)
  1053. #define SIO_GET_QOS                   _WSAIORW(IOC_WS2,7)
  1054. #define SIO_GET_GROUP_QOS             _WSAIORW(IOC_WS2,8)
  1055. #define SIO_MULTIPOINT_LOOPBACK       _WSAIOW(IOC_WS2,9)
  1056. #define SIO_MULTICAST_SCOPE           _WSAIOW(IOC_WS2,10)
  1057. #define SIO_SET_QOS                   _WSAIOW(IOC_WS2,11)
  1058. #define SIO_SET_GROUP_QOS             _WSAIOW(IOC_WS2,12)
  1059. #define SIO_TRANSLATE_HANDLE          _WSAIORW(IOC_WS2,13)
  1060.  
  1061. /*
  1062.  * WinSock 2 extension -- manifest constants for SIO_TRANSLATE_HANDLE ioctl
  1063.  */
  1064. #define TH_NETDEV        0x00000001
  1065. #define TH_TAPI          0x00000002
  1066.  
  1067.  
  1068. /*
  1069.  * Microsoft Windows Extended data types required for the functions to
  1070.  * convert   back  and  forth  between  binary  and  string  forms  of
  1071.  * addresses.
  1072.  */
  1073. typedef struct sockaddr SOCKADDR;
  1074. typedef struct sockaddr *PSOCKADDR;
  1075. typedef struct sockaddr FAR *LPSOCKADDR;
  1076.  
  1077. /*
  1078.  * Manifest constants and type definitions related to name resolution and
  1079.  * registration (RNR) API
  1080.  */
  1081.  
  1082. #ifndef _tagBLOB_DEFINED
  1083. #define _tagBLOB_DEFINED
  1084. #define _BLOB_DEFINED
  1085. #define _LPBLOB_DEFINED
  1086. typedef struct _BLOB {
  1087.     ULONG cbSize ;
  1088. #ifdef MIDL_PASS
  1089.     [size_is(cbSize)] BYTE *pBlobData;
  1090. #else  /* MIDL_PASS */
  1091.     BYTE *pBlobData ;
  1092. #endif /* MIDL_PASS */
  1093. } BLOB, *LPBLOB ;
  1094. #endif
  1095.  
  1096. /*
  1097.  * Service Install Flags
  1098.  */
  1099.  
  1100. #define SERVICE_MULTIPLE       (0x00000001)
  1101.  
  1102. /*
  1103.  *& Name Spaces
  1104.  */
  1105.  
  1106. #define NS_ALL                      (0)
  1107.  
  1108. #define NS_SAP                      (1)
  1109. #define NS_NDS                      (2)
  1110. #define NS_PEER_BROWSE              (3)
  1111.  
  1112. #define NS_TCPIP_LOCAL              (10)
  1113. #define NS_TCPIP_HOSTS              (11)
  1114. #define NS_DNS                      (12)
  1115. #define NS_NETBT                    (13)
  1116. #define NS_WINS                     (14)
  1117.  
  1118. #define NS_NBP                      (20)
  1119.  
  1120. #define NS_MS                       (30)
  1121. #define NS_STDA                     (31)
  1122. #define NS_NTDS                     (32)
  1123.  
  1124. #define NS_X500                     (40)
  1125. #define NS_NIS                      (41)
  1126. #define NS_NISPLUS                  (42)
  1127.  
  1128. #define NS_WRQ                      (50)
  1129.  
  1130. /*
  1131.  * Resolution flags for WSAGetAddressByName().
  1132.  * Note these are also used by the 1.1 API GetAddressByName, so
  1133.  * leave them around.
  1134.  */
  1135. #define RES_UNUSED_1                (0x00000001)
  1136. #define RES_FLUSH_CACHE             (0x00000002)
  1137. #ifndef RES_SERVICE
  1138. #define RES_SERVICE                 (0x00000004)
  1139. #endif /* RES_SERVICE */
  1140.  
  1141. /*
  1142.  * Well known value names for Service Types
  1143.  */
  1144.  
  1145. #define SERVICE_TYPE_VALUE_IPXPORTA      "IpxSocket"
  1146. #define SERVICE_TYPE_VALUE_IPXPORTW     L"IpxSocket"
  1147. #define SERVICE_TYPE_VALUE_SAPIDA        "SapId"
  1148. #define SERVICE_TYPE_VALUE_SAPIDW       L"SapId"
  1149.  
  1150. #define SERVICE_TYPE_VALUE_TCPPORTA      "TcpPort"
  1151. #define SERVICE_TYPE_VALUE_TCPPORTW     L"TcpPort"
  1152.  
  1153. #define SERVICE_TYPE_VALUE_UDPPORTA      "UdpPort"
  1154. #define SERVICE_TYPE_VALUE_UDPPORTW     L"UdpPort"
  1155.  
  1156. #define SERVICE_TYPE_VALUE_OBJECTIDA     "ObjectId"
  1157. #define SERVICE_TYPE_VALUE_OBJECTIDW    L"ObjectId"
  1158.  
  1159. #ifdef UNICODE
  1160.  
  1161. #define SERVICE_TYPE_VALUE_SAPID        SERVICE_TYPE_VALUE_SAPIDW
  1162. #define SERVICE_TYPE_VALUE_TCPPORT      SERVICE_TYPE_VALUE_TCPPORTW
  1163. #define SERVICE_TYPE_VALUE_UDPPORT      SERVICE_TYPE_VALUE_UDPPORTW
  1164. #define SERVICE_TYPE_VALUE_OBJECTID     SERVICE_TYPE_VALUE_OBJECTIDW
  1165.  
  1166. #else /* not UNICODE */
  1167.  
  1168. #define SERVICE_TYPE_VALUE_SAPID        SERVICE_TYPE_VALUE_SAPIDA
  1169. #define SERVICE_TYPE_VALUE_TCPPORT      SERVICE_TYPE_VALUE_TCPPORTA
  1170. #define SERVICE_TYPE_VALUE_UDPPORT      SERVICE_TYPE_VALUE_UDPPORTA
  1171. #define SERVICE_TYPE_VALUE_OBJECTID     SERVICE_TYPE_VALUE_OBJECTIDA
  1172.  
  1173. #endif
  1174.  
  1175. #ifndef __CSADDR_DEFINED__
  1176. #define __CSADDR_DEFINED__
  1177.  
  1178.  
  1179. /*
  1180.  * SockAddr Information
  1181.  */
  1182. typedef struct _SOCKET_ADDRESS {
  1183.     LPSOCKADDR lpSockaddr ;
  1184.     INT iSockaddrLength ;
  1185. } SOCKET_ADDRESS, *PSOCKET_ADDRESS, FAR * LPSOCKET_ADDRESS ;
  1186.  
  1187. /*
  1188.  * CSAddr Information
  1189.  */
  1190. typedef struct _CSADDR_INFO {
  1191.     SOCKET_ADDRESS LocalAddr ;
  1192.     SOCKET_ADDRESS RemoteAddr ;
  1193.     INT iSocketType ;
  1194.     INT iProtocol ;
  1195. } CSADDR_INFO, *PCSADDR_INFO, FAR * LPCSADDR_INFO ;
  1196. #endif // __CSADDR_DEFINED__
  1197.  
  1198. /*
  1199.  *  Address Family/Protocol Tuples
  1200.  */
  1201. typedef struct _AFPROTOCOLS {
  1202.     INT iAddressFamily;
  1203.     INT iProtocol;
  1204. } AFPROTOCOLS, *PAFPROTOCOLS, *LPAFPROTOCOLS;
  1205.  
  1206. /*
  1207.  * Client Query API Typedefs
  1208.  */
  1209.  
  1210. /*
  1211.  * The comparators
  1212.  */
  1213. typedef enum _WSAEcomparator
  1214. {
  1215.     COMP_EQUAL = 0,
  1216.     COMP_NOTLESS
  1217. } WSAECOMPARATOR, *PWSAECOMPARATOR, *LPWSAECOMPARATOR;
  1218.  
  1219. typedef struct _WSAVersion
  1220. {
  1221.     DWORD           dwVersion;
  1222.     WSAECOMPARATOR  ecHow;
  1223. }WSAVERSION, *PWSAVERSION, *LPWSAVERSION;
  1224.  
  1225. typedef struct _WSAQuerySetA
  1226. {
  1227.     DWORD           dwSize;
  1228.     LPSTR           lpszServiceInstanceName;
  1229.     LPGUID          lpServiceClassId;
  1230.     LPWSAVERSION    lpVersion;
  1231.     LPSTR           lpszComment;
  1232.     DWORD           dwNameSpace;
  1233.     LPGUID          lpNSProviderId;
  1234.     LPSTR           lpszContext;
  1235.     DWORD           dwNumberOfProtocols;
  1236.     LPAFPROTOCOLS   lpafpProtocols;
  1237.     LPSTR           lpszQueryString;
  1238.     DWORD           dwNumberOfCsAddrs;
  1239.     LPCSADDR_INFO   lpcsaBuffer;
  1240.     DWORD           dwOutputFlags;
  1241.     LPBLOB          lpBlob;
  1242. } WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;
  1243. typedef struct _WSAQuerySetW
  1244. {
  1245.     DWORD           dwSize;
  1246.     LPWSTR          lpszServiceInstanceName;
  1247.     LPGUID          lpServiceClassId;
  1248.     LPWSAVERSION    lpVersion;
  1249.     LPWSTR          lpszComment;
  1250.     DWORD           dwNameSpace;
  1251.     LPGUID          lpNSProviderId;
  1252.     LPWSTR          lpszContext;
  1253.     DWORD           dwNumberOfProtocols;
  1254.     LPAFPROTOCOLS   lpafpProtocols;
  1255.     LPWSTR          lpszQueryString;
  1256.     DWORD           dwNumberOfCsAddrs;
  1257.     LPCSADDR_INFO   lpcsaBuffer;
  1258.     DWORD           dwOutputFlags;
  1259.     LPBLOB          lpBlob;
  1260. } WSAQUERYSETW, *PWSAQUERYSETW, *LPWSAQUERYSETW;
  1261. #ifdef UNICODE
  1262. typedef WSAQUERYSETW WSAQUERYSET;
  1263. typedef PWSAQUERYSETW PWSAQUERYSET;
  1264. typedef LPWSAQUERYSETW LPWSAQUERYSET;
  1265. #else
  1266. typedef WSAQUERYSETA WSAQUERYSET;
  1267. typedef PWSAQUERYSETA PWSAQUERYSET;
  1268. typedef LPWSAQUERYSETA LPWSAQUERYSET;
  1269. #endif // UNICODE
  1270.  
  1271. #define LUP_DEEP                0x0001
  1272. #define LUP_CONTAINERS          0x0002
  1273. #define LUP_NOCONTAINERS        0x0004
  1274. #define LUP_NEAREST             0x0008
  1275. #define LUP_RETURN_NAME         0x0010
  1276. #define LUP_RETURN_TYPE         0x0020
  1277. #define LUP_RETURN_VERSION      0x0040
  1278. #define LUP_RETURN_COMMENT      0x0080
  1279. #define LUP_RETURN_ADDR         0x0100
  1280. #define LUP_RETURN_BLOB         0x0200
  1281. #define LUP_RETURN_ALIASES      0x0400
  1282. #define LUP_RETURN_QUERY_STRING 0x0800
  1283. #define LUP_RETURN_ALL          0x0FF0
  1284. #define LUP_RES_SERVICE         0x8000
  1285.  
  1286. #define LUP_FLUSHCACHE       0x1000
  1287. #define LUP_FLUSHPREVIOUS    0x2000
  1288.  
  1289.  
  1290. //
  1291. // Return flags
  1292. //
  1293.  
  1294. #define RESULT_IS_ALIAS      0x0001
  1295.  
  1296. /*
  1297.  * Service Address Registration and Deregistration Data Types.
  1298.  */
  1299.  
  1300. typedef enum _WSAESETSERVICEOP
  1301. {
  1302.     RNRSERVICE_REGISTER=0,
  1303.     RNRSERVICE_DEREGISTER,
  1304.     RNRSERVICE_DELETE
  1305. } WSAESETSERVICEOP, *PWSAESETSERVICEOP, *LPWSAESETSERVICEOP;
  1306.  
  1307. /*
  1308.  * Service Installation/Removal Data Types.
  1309.  */
  1310.  
  1311. typedef struct _WSANSClassInfoA
  1312. {
  1313.     LPSTR   lpszName;
  1314.     DWORD   dwNameSpace;
  1315.     DWORD   dwValueType;
  1316.     DWORD   dwValueSize;
  1317.     LPVOID  lpValue;
  1318. }WSANSCLASSINFOA, *PWSANSCLASSINFOA, *LPWSANSCLASSINFOA;
  1319. typedef struct _WSANSClassInfoW
  1320. {
  1321.     LPWSTR  lpszName;
  1322.     DWORD   dwNameSpace;
  1323.     DWORD   dwValueType;
  1324.     DWORD   dwValueSize;
  1325.     LPVOID  lpValue;
  1326. }WSANSCLASSINFOW, *PWSANSCLASSINFOW, *LPWSANSCLASSINFOW;
  1327. #ifdef UNICODE
  1328. typedef WSANSCLASSINFOW WSANSCLASSINFO;
  1329. typedef PWSANSCLASSINFOW PWSANSCLASSINFO;
  1330. typedef LPWSANSCLASSINFOW LPWSANSCLASSINFO;
  1331. #else
  1332. typedef WSANSCLASSINFOA WSANSCLASSINFO;
  1333. typedef PWSANSCLASSINFOA PWSANSCLASSINFO;
  1334. typedef LPWSANSCLASSINFOA LPWSANSCLASSINFO;
  1335. #endif // UNICODE
  1336.  
  1337. typedef struct _WSAServiceClassInfoA
  1338. {
  1339.     LPGUID              lpServiceClassId;
  1340.     LPSTR               lpszServiceClassName;
  1341.     DWORD               dwCount;
  1342.     LPWSANSCLASSINFOA   lpClassInfos;
  1343. }WSASERVICECLASSINFOA, *PWSASERVICECLASSINFOA, *LPWSASERVICECLASSINFOA;
  1344. typedef struct _WSAServiceClassInfoW
  1345. {
  1346.     LPGUID              lpServiceClassId;
  1347.     LPWSTR              lpszServiceClassName;
  1348.     DWORD               dwCount;
  1349.     LPWSANSCLASSINFOW   lpClassInfos;
  1350. }WSASERVICECLASSINFOW, *PWSASERVICECLASSINFOW, *LPWSASERVICECLASSINFOW;
  1351. #ifdef UNICODE
  1352. typedef WSASERVICECLASSINFOW WSASERVICECLASSINFO;
  1353. typedef PWSASERVICECLASSINFOW PWSASERVICECLASSINFO;
  1354. typedef LPWSASERVICECLASSINFOW LPWSASERVICECLASSINFO;
  1355. #else
  1356. typedef WSASERVICECLASSINFOA WSASERVICECLASSINFO;
  1357. typedef PWSASERVICECLASSINFOA PWSASERVICECLASSINFO;
  1358. typedef LPWSASERVICECLASSINFOA LPWSASERVICECLASSINFO;
  1359. #endif // UNICODE
  1360.  
  1361. typedef struct _WSANAMESPACE_INFOA {
  1362.     GUID                NSProviderId;
  1363.     DWORD               dwNameSpace;
  1364.     BOOL                fActive;
  1365.     DWORD               dwVersion;
  1366.     LPSTR               lpszIdentifier;
  1367. } WSANAMESPACE_INFOA, *PWSANAMESPACE_INFOA, *LPWSANAMESPACE_INFOA;
  1368. typedef struct _WSANAMESPACE_INFOW {
  1369.     GUID                NSProviderId;
  1370.     DWORD               dwNameSpace;
  1371.     BOOL                fActive;
  1372.     DWORD               dwVersion;
  1373.     LPWSTR              lpszIdentifier;
  1374. } WSANAMESPACE_INFOW, *PWSANAMESPACE_INFOW, *LPWSANAMESPACE_INFOW;
  1375. #ifdef UNICODE
  1376. typedef WSANAMESPACE_INFOW WSANAMESPACE_INFO;
  1377. typedef PWSANAMESPACE_INFOW PWSANAMESPACE_INFO;
  1378. typedef LPWSANAMESPACE_INFOW LPWSANAMESPACE_INFO;
  1379. #else
  1380. typedef WSANAMESPACE_INFOA WSANAMESPACE_INFO;
  1381. typedef PWSANAMESPACE_INFOA PWSANAMESPACE_INFO;
  1382. typedef LPWSANAMESPACE_INFOA LPWSANAMESPACE_INFO;
  1383. #endif // UNICODE
  1384.  
  1385. /* Socket function prototypes */
  1386.  
  1387. #if INCL_WINSOCK_API_PROTOTYPES
  1388. WINSOCK_API_LINKAGE
  1389. SOCKET
  1390. WSAAPI
  1391. accept(
  1392.     SOCKET s,
  1393.     struct sockaddr FAR * addr,
  1394.     int FAR * addrlen
  1395.     );
  1396. #endif // INCL_WINSOCK_API_PROTOTYPES
  1397.  
  1398. #if INCL_WINSOCK_API_TYPEDEFS
  1399. typedef
  1400. SOCKET
  1401. (WSAAPI * LPFN_ACCEPT)(
  1402.     SOCKET s,
  1403.     struct sockaddr FAR * addr,
  1404.     int FAR * addrlen
  1405.     );
  1406. #endif // INCL_WINSOCK_API_TYPEDEFS
  1407.  
  1408. #if INCL_WINSOCK_API_PROTOTYPES
  1409. WINSOCK_API_LINKAGE
  1410. int
  1411. WSAAPI
  1412. bind(
  1413.     SOCKET s,
  1414.     const struct sockaddr FAR * name,
  1415.     int namelen
  1416.     );
  1417. #endif // INCL_WINSOCK_API_PROTOTYPES
  1418.  
  1419. #if INCL_WINSOCK_API_TYPEDEFS
  1420. typedef
  1421. int
  1422. (WSAAPI * LPFN_BIND)(
  1423.     SOCKET s,
  1424.     const struct sockaddr FAR * name,
  1425.     int namelen
  1426.     );
  1427. #endif // INCL_WINSOCK_API_TYPEDEFS
  1428.  
  1429. #if INCL_WINSOCK_API_PROTOTYPES
  1430. WINSOCK_API_LINKAGE
  1431. int
  1432. WSAAPI
  1433. closesocket(
  1434.     SOCKET s
  1435.     );
  1436. #endif // INCL_WINSOCK_API_PROTOTYPES
  1437.  
  1438. #if INCL_WINSOCK_API_TYPEDEFS
  1439. typedef
  1440. int
  1441. (WSAAPI * LPFN_CLOSESOCKET)(
  1442.     SOCKET s
  1443.     );
  1444. #endif // INCL_WINSOCK_API_TYPEDEFS
  1445.  
  1446. #if INCL_WINSOCK_API_PROTOTYPES
  1447. WINSOCK_API_LINKAGE
  1448. int
  1449. WSAAPI
  1450. connect(
  1451.     SOCKET s,
  1452.     const struct sockaddr FAR * name,
  1453.     int namelen
  1454.     );
  1455. #endif // INCL_WINSOCK_API_PROTOTYPES
  1456.  
  1457. #if INCL_WINSOCK_API_TYPEDEFS
  1458. typedef
  1459. int
  1460. (WSAAPI * LPFN_CONNECT)(
  1461.     SOCKET s,
  1462.     const struct sockaddr FAR * name,
  1463.     int namelen
  1464.     );
  1465. #endif // INCL_WINSOCK_API_TYPEDEFS
  1466.  
  1467. #if INCL_WINSOCK_API_PROTOTYPES
  1468. WINSOCK_API_LINKAGE
  1469. int
  1470. WSAAPI
  1471. ioctlsocket(
  1472.     SOCKET s,
  1473.     long cmd,
  1474.     u_long FAR * argp
  1475.     );
  1476. #endif // INCL_WINSOCK_API_PROTOTYPES
  1477.  
  1478. #if INCL_WINSOCK_API_TYPEDEFS
  1479. typedef
  1480. int
  1481. (WSAAPI * LPFN_IOCTLSOCKET)(
  1482.     SOCKET s,
  1483.     long cmd,
  1484.     u_long FAR * argp
  1485.     );
  1486. #endif // INCL_WINSOCK_API_TYPEDEFS
  1487.  
  1488. #if INCL_WINSOCK_API_PROTOTYPES
  1489. WINSOCK_API_LINKAGE
  1490. int
  1491. WSAAPI
  1492. getpeername(
  1493.     SOCKET s,
  1494.     struct sockaddr FAR * name,
  1495.     int FAR * namelen
  1496.     );
  1497. #endif // INCL_WINSOCK_API_PROTOTYPES
  1498.  
  1499. #if INCL_WINSOCK_API_TYPEDEFS
  1500. typedef
  1501. int
  1502. (WSAAPI * LPFN_GETPEERNAME)(
  1503.     SOCKET s,
  1504.     struct sockaddr FAR * name,
  1505.     int FAR * namelen
  1506.     );
  1507. #endif // INCL_WINSOCK_API_TYPEDEFS
  1508.  
  1509. #if INCL_WINSOCK_API_PROTOTYPES
  1510. WINSOCK_API_LINKAGE
  1511. int
  1512. WSAAPI
  1513. getsockname(
  1514.     SOCKET s,
  1515.     struct sockaddr FAR * name,
  1516.     int FAR * namelen
  1517.     );
  1518. #endif // INCL_WINSOCK_API_PROTOTYPES
  1519.  
  1520. #if INCL_WINSOCK_API_TYPEDEFS
  1521. typedef
  1522. int
  1523. (WSAAPI * LPFN_GETSOCKNAME)(
  1524.     SOCKET s,
  1525.     struct sockaddr FAR * name,
  1526.     int FAR * namelen
  1527.     );
  1528. #endif // INCL_WINSOCK_API_TYPEDEFS
  1529.  
  1530. #if INCL_WINSOCK_API_PROTOTYPES
  1531. WINSOCK_API_LINKAGE
  1532. int
  1533. WSAAPI
  1534. getsockopt(
  1535.     SOCKET s,
  1536.     int level,
  1537.     int optname,
  1538.     char FAR * optval,
  1539.     int FAR * optlen
  1540.     );
  1541. #endif // INCL_WINSOCK_API_PROTOTYPES
  1542.  
  1543. #if INCL_WINSOCK_API_TYPEDEFS
  1544. typedef
  1545. int
  1546. (WSAAPI * LPFN_GETSOCKOPT)(
  1547.     SOCKET s,
  1548.     int level,
  1549.     int optname,
  1550.     char FAR * optval,
  1551.     int FAR * optlen
  1552.     );
  1553. #endif // INCL_WINSOCK_API_TYPEDEFS
  1554.  
  1555. #if INCL_WINSOCK_API_PROTOTYPES
  1556. WINSOCK_API_LINKAGE
  1557. u_long
  1558. WSAAPI
  1559. htonl(
  1560.     u_long hostlong
  1561.     );
  1562. #endif // INCL_WINSOCK_API_PROTOTYPES
  1563.  
  1564. #if INCL_WINSOCK_API_TYPEDEFS
  1565. typedef
  1566. u_long
  1567. (WSAAPI * LPFN_HTONL)(
  1568.     u_long hostlong
  1569.     );
  1570. #endif // INCL_WINSOCK_API_TYPEDEFS
  1571.  
  1572. #if INCL_WINSOCK_API_PROTOTYPES
  1573. WINSOCK_API_LINKAGE
  1574. u_short
  1575. WSAAPI
  1576. htons(
  1577.     u_short hostshort
  1578.     );
  1579. #endif // INCL_WINSOCK_API_PROTOTYPES
  1580.  
  1581. #if INCL_WINSOCK_API_TYPEDEFS
  1582. typedef
  1583. u_short
  1584. (WSAAPI * LPFN_HTONS)(
  1585.     u_short hostshort
  1586.     );
  1587. #endif // INCL_WINSOCK_API_TYPEDEFS
  1588.  
  1589. #if INCL_WINSOCK_API_PROTOTYPES
  1590. WINSOCK_API_LINKAGE
  1591. unsigned long
  1592. WSAAPI
  1593. inet_addr(
  1594.     const char FAR * cp
  1595.     );
  1596. #endif // INCL_WINSOCK_API_PROTOTYPES
  1597.  
  1598. #if INCL_WINSOCK_API_TYPEDEFS
  1599. typedef
  1600. unsigned long
  1601. (WSAAPI * LPFN_INET_ADDR)(
  1602.     const char FAR * cp
  1603.     );
  1604. #endif // INCL_WINSOCK_API_TYPEDEFS
  1605.  
  1606. #if INCL_WINSOCK_API_PROTOTYPES
  1607. WINSOCK_API_LINKAGE
  1608. char FAR *
  1609. WSAAPI
  1610. inet_ntoa(
  1611.     struct in_addr in
  1612.     );
  1613. #endif // INCL_WINSOCK_API_PROTOTYPES
  1614.  
  1615. #if INCL_WINSOCK_API_TYPEDEFS
  1616. typedef
  1617. char FAR *
  1618. (WSAAPI * LPFN_INET_NTOA)(
  1619.     struct in_addr in
  1620.     );
  1621. #endif // INCL_WINSOCK_API_TYPEDEFS
  1622.  
  1623. #if INCL_WINSOCK_API_PROTOTYPES
  1624. WINSOCK_API_LINKAGE
  1625. int
  1626. WSAAPI
  1627. listen(
  1628.     SOCKET s,
  1629.     int backlog
  1630.     );
  1631. #endif // INCL_WINSOCK_API_PROTOTYPES
  1632.  
  1633. #if INCL_WINSOCK_API_TYPEDEFS
  1634. typedef
  1635. int
  1636. (WSAAPI * LPFN_LISTEN)(
  1637.     SOCKET s,
  1638.     int backlog
  1639.     );
  1640. #endif // INCL_WINSOCK_API_TYPEDEFS
  1641.  
  1642. #if INCL_WINSOCK_API_PROTOTYPES
  1643. WINSOCK_API_LINKAGE
  1644. u_long
  1645. WSAAPI
  1646. ntohl(
  1647.     u_long netlong
  1648.     );
  1649. #endif // INCL_WINSOCK_API_PROTOTYPES
  1650.  
  1651. #if INCL_WINSOCK_API_TYPEDEFS
  1652. typedef
  1653. u_long
  1654. (WSAAPI * LPFN_NTOHL)(
  1655.     u_long netlong
  1656.     );
  1657. #endif // INCL_WINSOCK_API_TYPEDEFS
  1658.  
  1659. #if INCL_WINSOCK_API_PROTOTYPES
  1660. WINSOCK_API_LINKAGE
  1661. u_short
  1662. WSAAPI
  1663. ntohs(
  1664.     u_short netshort
  1665.     );
  1666. #endif // INCL_WINSOCK_API_PROTOTYPES
  1667.  
  1668. #if INCL_WINSOCK_API_TYPEDEFS
  1669. typedef
  1670. u_short
  1671. (WSAAPI * LPFN_NTOHS)(
  1672.     u_short netshort
  1673.     );
  1674. #endif // INCL_WINSOCK_API_TYPEDEFS
  1675.  
  1676. #if INCL_WINSOCK_API_PROTOTYPES
  1677. WINSOCK_API_LINKAGE
  1678. int
  1679. WSAAPI
  1680. recv(
  1681.     SOCKET s,
  1682.     char FAR * buf,
  1683.     int len,
  1684.     int flags
  1685.     );
  1686. #endif // INCL_WINSOCK_API_PROTOTYPES
  1687.  
  1688. #if INCL_WINSOCK_API_TYPEDEFS
  1689. typedef
  1690. int
  1691. (WSAAPI * LPFN_RECV)(
  1692.     SOCKET s,
  1693.     char FAR * buf,
  1694.     int len,
  1695.     int flags
  1696.     );
  1697. #endif // INCL_WINSOCK_API_TYPEDEFS
  1698.  
  1699. #if INCL_WINSOCK_API_PROTOTYPES
  1700. WINSOCK_API_LINKAGE
  1701. int
  1702. WSAAPI
  1703. recvfrom(
  1704.     SOCKET s,
  1705.     char FAR * buf,
  1706.     int len,
  1707.     int flags,
  1708.     struct sockaddr FAR * from,
  1709.     int FAR * fromlen
  1710.     );
  1711. #endif // INCL_WINSOCK_API_PROTOTYPES
  1712.  
  1713. #if INCL_WINSOCK_API_TYPEDEFS
  1714. typedef
  1715. int
  1716. (WSAAPI * LPFN_RECVFROM)(
  1717.     SOCKET s,
  1718.     char FAR * buf,
  1719.     int len,
  1720.     int flags,
  1721.     struct sockaddr FAR * from,
  1722.     int FAR * fromlen
  1723.     );
  1724. #endif // INCL_WINSOCK_API_TYPEDEFS
  1725.  
  1726. #if INCL_WINSOCK_API_PROTOTYPES
  1727. WINSOCK_API_LINKAGE
  1728. int
  1729. WSAAPI
  1730. select(
  1731.     int nfds,
  1732.     fd_set FAR * readfds,
  1733.     fd_set FAR * writefds,
  1734.     fd_set FAR *exceptfds,
  1735.     const struct timeval FAR * timeout
  1736.     );
  1737. #endif // INCL_WINSOCK_API_PROTOTYPES
  1738.  
  1739. #if INCL_WINSOCK_API_TYPEDEFS
  1740. typedef
  1741. int
  1742. (WSAAPI * LPFN_SELECT)(
  1743.     int nfds,
  1744.     fd_set FAR * readfds,
  1745.     fd_set FAR * writefds,
  1746.     fd_set FAR *exceptfds,
  1747.     const struct timeval FAR * timeout
  1748.     );
  1749. #endif // INCL_WINSOCK_API_TYPEDEFS
  1750.  
  1751. #if INCL_WINSOCK_API_PROTOTYPES
  1752. WINSOCK_API_LINKAGE
  1753. int
  1754. WSAAPI
  1755. send(
  1756.     SOCKET s,
  1757.     const char FAR * buf,
  1758.     int len,
  1759.     int flags
  1760.     );
  1761. #endif // INCL_WINSOCK_API_PROTOTYPES
  1762.  
  1763. #if INCL_WINSOCK_API_TYPEDEFS
  1764. typedef
  1765. int
  1766. (WSAAPI * LPFN_SEND)(
  1767.     SOCKET s,
  1768.     const char FAR * buf,
  1769.     int len,
  1770.     int flags
  1771.     );
  1772. #endif // INCL_WINSOCK_API_TYPEDEFS
  1773.  
  1774. #if INCL_WINSOCK_API_PROTOTYPES
  1775. WINSOCK_API_LINKAGE
  1776. int
  1777. WSAAPI
  1778. sendto(
  1779.     SOCKET s,
  1780.     const char FAR * buf,
  1781.     int len,
  1782.     int flags,
  1783.     const struct sockaddr FAR * to,
  1784.     int tolen
  1785.     );
  1786. #endif // INCL_WINSOCK_API_PROTOTYPES
  1787.  
  1788. #if INCL_WINSOCK_API_TYPEDEFS
  1789. typedef
  1790. int
  1791. (WSAAPI * LPFN_SENDTO)(
  1792.     SOCKET s,
  1793.     const char FAR * buf,
  1794.     int len,
  1795.     int flags,
  1796.     const struct sockaddr FAR * to,
  1797.     int tolen
  1798.     );
  1799. #endif // INCL_WINSOCK_API_TYPEDEFS
  1800.  
  1801. #if INCL_WINSOCK_API_PROTOTYPES
  1802. WINSOCK_API_LINKAGE
  1803. int
  1804. WSAAPI
  1805. setsockopt(
  1806.     SOCKET s,
  1807.     int level,
  1808.     int optname,
  1809.     const char FAR * optval,
  1810.     int optlen
  1811.     );
  1812. #endif // INCL_WINSOCK_API_PROTOTYPES
  1813.  
  1814. #if INCL_WINSOCK_API_TYPEDEFS
  1815. typedef
  1816. int
  1817. (WSAAPI * LPFN_SETSOCKOPT)(
  1818.     SOCKET s,
  1819.     int level,
  1820.     int optname,
  1821.     const char FAR * optval,
  1822.     int optlen
  1823.     );
  1824. #endif // INCL_WINSOCK_API_TYPEDEFS
  1825.  
  1826. #if INCL_WINSOCK_API_PROTOTYPES
  1827. WINSOCK_API_LINKAGE
  1828. int
  1829. WSAAPI
  1830. shutdown(
  1831.     SOCKET s,
  1832.     int how
  1833.     );
  1834. #endif // INCL_WINSOCK_API_PROTOTYPES
  1835.  
  1836. #if INCL_WINSOCK_API_TYPEDEFS
  1837. typedef
  1838. int
  1839. (WSAAPI * LPFN_SHUTDOWN)(
  1840.     SOCKET s,
  1841.     int how
  1842.     );
  1843. #endif // INCL_WINSOCK_API_TYPEDEFS
  1844.  
  1845. #if INCL_WINSOCK_API_PROTOTYPES
  1846. WINSOCK_API_LINKAGE
  1847. SOCKET
  1848. WSAAPI
  1849. socket(
  1850.     int af,
  1851.     int type,
  1852.     int protocol
  1853.     );
  1854. #endif // INCL_WINSOCK_API_PROTOTYPES
  1855.  
  1856. #if INCL_WINSOCK_API_TYPEDEFS
  1857. typedef
  1858. SOCKET
  1859. (WSAAPI * LPFN_SOCKET)(
  1860.     int af,
  1861.     int type,
  1862.     int protocol
  1863.     );
  1864. #endif // INCL_WINSOCK_API_TYPEDEFS
  1865.  
  1866. /* Database function prototypes */
  1867.  
  1868. #if INCL_WINSOCK_API_PROTOTYPES
  1869. WINSOCK_API_LINKAGE
  1870. struct hostent FAR *
  1871. WSAAPI
  1872. gethostbyaddr(
  1873.     const char FAR * addr,
  1874.     int len,
  1875.     int type
  1876.     );
  1877. #endif // INCL_WINSOCK_API_PROTOTYPES
  1878.  
  1879. #if INCL_WINSOCK_API_TYPEDEFS
  1880. typedef
  1881. struct hostent FAR *
  1882. (WSAAPI * LPFN_GETHOSTBYADDR)(
  1883.     const char FAR * addr,
  1884.     int len,
  1885.     int type
  1886.     );
  1887. #endif // INCL_WINSOCK_API_TYPEDEFS
  1888.  
  1889. #if INCL_WINSOCK_API_PROTOTYPES
  1890. WINSOCK_API_LINKAGE
  1891. struct hostent FAR *
  1892. WSAAPI
  1893. gethostbyname(
  1894.     const char FAR * name
  1895.     );
  1896. #endif // INCL_WINSOCK_API_PROTOTYPES
  1897.  
  1898. #if INCL_WINSOCK_API_TYPEDEFS
  1899. typedef
  1900. struct hostent FAR *
  1901. (WSAAPI * LPFN_GETHOSTBYNAME)(
  1902.     const char FAR * name
  1903.     );
  1904. #endif // INCL_WINSOCK_API_TYPEDEFS
  1905.  
  1906. #if INCL_WINSOCK_API_PROTOTYPES
  1907. WINSOCK_API_LINKAGE
  1908. int
  1909. WSAAPI
  1910. gethostname(
  1911.     char FAR * name,
  1912.     int namelen
  1913.     );
  1914. #endif // INCL_WINSOCK_API_PROTOTYPES
  1915.  
  1916. #if INCL_WINSOCK_API_TYPEDEFS
  1917. typedef
  1918. int
  1919. (WSAAPI * LPFN_GETHOSTNAME)(
  1920.     char FAR * name,
  1921.     int namelen
  1922.     );
  1923. #endif // INCL_WINSOCK_API_TYPEDEFS
  1924.  
  1925. #if INCL_WINSOCK_API_PROTOTYPES
  1926. WINSOCK_API_LINKAGE
  1927. struct servent FAR *
  1928. WSAAPI
  1929. getservbyport(
  1930.     int port,
  1931.     const char FAR * proto
  1932.     );
  1933. #endif // INCL_WINSOCK_API_PROTOTYPES
  1934.  
  1935. #if INCL_WINSOCK_API_TYPEDEFS
  1936. typedef
  1937. struct servent FAR *
  1938. (WSAAPI * LPFN_GETSERVBYPORT)(
  1939.     int port,
  1940.     const char FAR * proto
  1941.     );
  1942. #endif // INCL_WINSOCK_API_TYPEDEFS
  1943.  
  1944. #if INCL_WINSOCK_API_PROTOTYPES
  1945. WINSOCK_API_LINKAGE
  1946. struct servent FAR *
  1947. WSAAPI
  1948. getservbyname(
  1949.     const char FAR * name,
  1950.     const char FAR * proto
  1951.     );
  1952. #endif // INCL_WINSOCK_API_PROTOTYPES
  1953.  
  1954. #if INCL_WINSOCK_API_TYPEDEFS
  1955. typedef
  1956. struct servent FAR *
  1957. (WSAAPI * LPFN_GETSERVBYNAME)(
  1958.     const char FAR * name,
  1959.     const char FAR * proto
  1960.     );
  1961. #endif // INCL_WINSOCK_API_TYPEDEFS
  1962.  
  1963. #if INCL_WINSOCK_API_PROTOTYPES
  1964. WINSOCK_API_LINKAGE
  1965. struct protoent FAR *
  1966. WSAAPI
  1967. getprotobynumber(
  1968.     int number
  1969.     );
  1970. #endif // INCL_WINSOCK_API_PROTOTYPES
  1971.  
  1972. #if INCL_WINSOCK_API_TYPEDEFS
  1973. typedef
  1974. struct protoent FAR *
  1975. (WSAAPI * LPFN_GETPROTOBYNUMBER)(
  1976.     int number
  1977.     );
  1978. #endif // INCL_WINSOCK_API_TYPEDEFS
  1979.  
  1980. #if INCL_WINSOCK_API_PROTOTYPES
  1981. WINSOCK_API_LINKAGE
  1982. struct protoent FAR *
  1983. WSAAPI
  1984. getprotobyname(
  1985.     const char FAR * name
  1986.     );
  1987. #endif // INCL_WINSOCK_API_PROTOTYPES
  1988.  
  1989. #if INCL_WINSOCK_API_TYPEDEFS
  1990. typedef
  1991. struct protoent FAR *
  1992. (WSAAPI * LPFN_GETPROTOBYNAME)(
  1993.     const char FAR * name
  1994.     );
  1995. #endif // INCL_WINSOCK_API_TYPEDEFS
  1996.  
  1997. /* Microsoft Windows Extension function prototypes */
  1998.  
  1999. #if INCL_WINSOCK_API_PROTOTYPES
  2000. WINSOCK_API_LINKAGE
  2001. int
  2002. WSAAPI
  2003. WSAStartup(
  2004.     WORD wVersionRequested,
  2005.     LPWSADATA lpWSAData
  2006.     );
  2007. #endif // INCL_WINSOCK_API_PROTOTYPES
  2008.  
  2009. #if INCL_WINSOCK_API_TYPEDEFS
  2010. typedef
  2011. int
  2012. (WSAAPI * LPFN_WSASTARTUP)(
  2013.     WORD wVersionRequested,
  2014.     LPWSADATA lpWSAData
  2015.     );
  2016. #endif // INCL_WINSOCK_API_TYPEDEFS
  2017.  
  2018. #if INCL_WINSOCK_API_PROTOTYPES
  2019. WINSOCK_API_LINKAGE
  2020. int
  2021. WSAAPI
  2022. WSACleanup(
  2023.     void
  2024.     );
  2025. #endif // INCL_WINSOCK_API_PROTOTYPES
  2026.  
  2027. #if INCL_WINSOCK_API_TYPEDEFS
  2028. typedef
  2029. int
  2030. (WSAAPI * LPFN_WSACLEANUP)(
  2031.     void
  2032.     );
  2033. #endif // INCL_WINSOCK_API_TYPEDEFS
  2034.  
  2035. #if INCL_WINSOCK_API_PROTOTYPES
  2036. WINSOCK_API_LINKAGE
  2037. void
  2038. WSAAPI
  2039. WSASetLastError(
  2040.     int iError
  2041.     );
  2042. #endif // INCL_WINSOCK_API_PROTOTYPES
  2043.  
  2044. #if INCL_WINSOCK_API_TYPEDEFS
  2045. typedef
  2046. void
  2047. (WSAAPI * LPFN_WSASETLASTERROR)(
  2048.     int iError
  2049.     );
  2050. #endif // INCL_WINSOCK_API_TYPEDEFS
  2051.  
  2052. #if INCL_WINSOCK_API_PROTOTYPES
  2053. WINSOCK_API_LINKAGE
  2054. int
  2055. WSAAPI
  2056. WSAGetLastError(
  2057.     void
  2058.     );
  2059. #endif // INCL_WINSOCK_API_PROTOTYPES
  2060.  
  2061. #if INCL_WINSOCK_API_TYPEDEFS
  2062. typedef
  2063. int
  2064. (WSAAPI * LPFN_WSAGETLASTERROR)(
  2065.     void
  2066.     );
  2067. #endif // INCL_WINSOCK_API_TYPEDEFS
  2068.  
  2069. #if INCL_WINSOCK_API_PROTOTYPES
  2070. WINSOCK_API_LINKAGE
  2071. BOOL
  2072. WSAAPI
  2073. WSAIsBlocking(
  2074.     void
  2075.     );
  2076. #endif // INCL_WINSOCK_API_PROTOTYPES
  2077.  
  2078. #if INCL_WINSOCK_API_TYPEDEFS
  2079. typedef
  2080. BOOL
  2081. (WSAAPI * LPFN_WSAISBLOCKING)(
  2082.     void
  2083.     );
  2084. #endif // INCL_WINSOCK_API_TYPEDEFS
  2085.  
  2086. #if INCL_WINSOCK_API_PROTOTYPES
  2087. WINSOCK_API_LINKAGE
  2088. int
  2089. WSAAPI
  2090. WSAUnhookBlockingHook(
  2091.     void
  2092.     );
  2093. #endif // INCL_WINSOCK_API_PROTOTYPES
  2094.  
  2095. #if INCL_WINSOCK_API_TYPEDEFS
  2096. typedef
  2097. int
  2098. (WSAAPI * LPFN_WSAUNHOOKBLOCKINGHOOK)(
  2099.     void
  2100.     );
  2101. #endif // INCL_WINSOCK_API_TYPEDEFS
  2102.  
  2103. #if INCL_WINSOCK_API_PROTOTYPES
  2104. WINSOCK_API_LINKAGE
  2105. FARPROC
  2106. WSAAPI
  2107. WSASetBlockingHook(
  2108.     FARPROC lpBlockFunc
  2109.     );
  2110. #endif // INCL_WINSOCK_API_PROTOTYPES
  2111.  
  2112. #if INCL_WINSOCK_API_TYPEDEFS
  2113. typedef
  2114. FARPROC
  2115. (WSAAPI * LPFN_WSASETBLOCKINGHOOK)(
  2116.     FARPROC lpBlockFunc
  2117.     );
  2118. #endif // INCL_WINSOCK_API_TYPEDEFS
  2119.  
  2120. #if INCL_WINSOCK_API_PROTOTYPES
  2121. WINSOCK_API_LINKAGE
  2122. int
  2123. WSAAPI
  2124. WSACancelBlockingCall(
  2125.     void
  2126.     );
  2127. #endif // INCL_WINSOCK_API_PROTOTYPES
  2128.  
  2129. #if INCL_WINSOCK_API_TYPEDEFS
  2130. typedef
  2131. int
  2132. (WSAAPI * LPFN_WSACANCELBLOCKINGCALL)(
  2133.     void
  2134.     );
  2135. #endif // INCL_WINSOCK_API_TYPEDEFS
  2136.  
  2137. #if INCL_WINSOCK_API_PROTOTYPES
  2138. WINSOCK_API_LINKAGE
  2139. HANDLE
  2140. WSAAPI
  2141. WSAAsyncGetServByName(
  2142.     HWND hWnd,
  2143.     u_int wMsg,
  2144.     const char FAR * name,
  2145.     const char FAR * proto,
  2146.     char FAR * buf,
  2147.     int buflen
  2148.     );
  2149. #endif // INCL_WINSOCK_API_PROTOTYPES
  2150.  
  2151. #if INCL_WINSOCK_API_TYPEDEFS
  2152. typedef
  2153. HANDLE
  2154. (WSAAPI * LPFN_WSAASYNCGETSERVBYNAME)(
  2155.     HWND hWnd,
  2156.     u_int wMsg,
  2157.     const char FAR * name,
  2158.     const char FAR * proto,
  2159.     char FAR * buf,
  2160.     int buflen
  2161.     );
  2162. #endif // INCL_WINSOCK_API_TYPEDEFS
  2163.  
  2164. #if INCL_WINSOCK_API_PROTOTYPES
  2165. WINSOCK_API_LINKAGE
  2166. HANDLE
  2167. WSAAPI
  2168. WSAAsyncGetServByPort(
  2169.     HWND hWnd,
  2170.     u_int wMsg,
  2171.     int port,
  2172.     const char FAR * proto,
  2173.     char FAR * buf,
  2174.     int buflen
  2175.     );
  2176. #endif // INCL_WINSOCK_API_PROTOTYPES
  2177.  
  2178. #if INCL_WINSOCK_API_TYPEDEFS
  2179. typedef
  2180. HANDLE
  2181. (WSAAPI * LPFN_WSAASYNCGETSERVBYPORT)(
  2182.     HWND hWnd,
  2183.     u_int wMsg,
  2184.     int port,
  2185.     const char FAR * proto,
  2186.     char FAR * buf,
  2187.     int buflen
  2188.     );
  2189. #endif // INCL_WINSOCK_API_TYPEDEFS
  2190.  
  2191. #if INCL_WINSOCK_API_PROTOTYPES
  2192. WINSOCK_API_LINKAGE
  2193. HANDLE
  2194. WSAAPI
  2195. WSAAsyncGetProtoByName(
  2196.     HWND hWnd,
  2197.     u_int wMsg,
  2198.     const char FAR * name,
  2199.     char FAR * buf,
  2200.     int buflen
  2201.     );
  2202. #endif // INCL_WINSOCK_API_PROTOTYPES
  2203.  
  2204. #if INCL_WINSOCK_API_TYPEDEFS
  2205. typedef
  2206. HANDLE
  2207. (WSAAPI * LPFN_WSAASYNCGETPROTOBYNAME)(
  2208.     HWND hWnd,
  2209.     u_int wMsg,
  2210.     const char FAR * name,
  2211.     char FAR * buf,
  2212.     int buflen
  2213.     );
  2214. #endif // INCL_WINSOCK_API_TYPEDEFS
  2215.  
  2216. #if INCL_WINSOCK_API_PROTOTYPES
  2217. WINSOCK_API_LINKAGE
  2218. HANDLE
  2219. WSAAPI
  2220. WSAAsyncGetProtoByNumber(
  2221.     HWND hWnd,
  2222.     u_int wMsg,
  2223.     int number,
  2224.     char FAR * buf,
  2225.     int buflen
  2226.     );
  2227. #endif // INCL_WINSOCK_API_PROTOTYPES
  2228.  
  2229. #if INCL_WINSOCK_API_TYPEDEFS
  2230. typedef
  2231. HANDLE
  2232. (WSAAPI * LPFN_WSAASYNCGETPROTOBYNUMBER)(
  2233.     HWND hWnd,
  2234.     u_int wMsg,
  2235.     int number,
  2236.     char FAR * buf,
  2237.     int buflen
  2238.     );
  2239. #endif // INCL_WINSOCK_API_TYPEDEFS
  2240.  
  2241. #if INCL_WINSOCK_API_PROTOTYPES
  2242. WINSOCK_API_LINKAGE
  2243. HANDLE
  2244. WSAAPI
  2245. WSAAsyncGetHostByName(
  2246.     HWND hWnd,
  2247.     u_int wMsg,
  2248.     const char FAR * name,
  2249.     char FAR * buf,
  2250.     int buflen
  2251.     );
  2252. #endif // INCL_WINSOCK_API_PROTOTYPES
  2253.  
  2254. #if INCL_WINSOCK_API_TYPEDEFS
  2255. typedef
  2256. HANDLE
  2257. (WSAAPI * LPFN_WSAASYNCGETHOSTBYNAME)(
  2258.     HWND hWnd,
  2259.     u_int wMsg,
  2260.     const char FAR * name,
  2261.     char FAR * buf,
  2262.     int buflen
  2263.     );
  2264. #endif // INCL_WINSOCK_API_TYPEDEFS
  2265.  
  2266. #if INCL_WINSOCK_API_PROTOTYPES
  2267. WINSOCK_API_LINKAGE
  2268. HANDLE
  2269. WSAAPI
  2270. WSAAsyncGetHostByAddr(
  2271.     HWND hWnd,
  2272.     u_int wMsg,
  2273.     const char FAR * addr,
  2274.     int len,
  2275.     int type,
  2276.     char FAR * buf,
  2277.     int buflen
  2278.     );
  2279. #endif // INCL_WINSOCK_API_PROTOTYPES
  2280.  
  2281. #if INCL_WINSOCK_API_TYPEDEFS
  2282. typedef
  2283. HANDLE
  2284. (WSAAPI * LPFN_WSAASYNCGETHOSTBYADDR)(
  2285.     HWND hWnd,
  2286.     u_int wMsg,
  2287.     const char FAR * addr,
  2288.     int len,
  2289.     int type,
  2290.     char FAR * buf,
  2291.     int buflen
  2292.     );
  2293. #endif // INCL_WINSOCK_API_TYPEDEFS
  2294.  
  2295. #if INCL_WINSOCK_API_PROTOTYPES
  2296. WINSOCK_API_LINKAGE
  2297. int
  2298. WSAAPI
  2299. WSACancelAsyncRequest(
  2300.     HANDLE hAsyncTaskHandle
  2301.     );
  2302. #endif // INCL_WINSOCK_API_PROTOTYPES
  2303.  
  2304. #if INCL_WINSOCK_API_TYPEDEFS
  2305. typedef
  2306. int
  2307. (WSAAPI * LPFN_WSACANCELASYNCREQUEST)(
  2308.     HANDLE hAsyncTaskHandle
  2309.     );
  2310. #endif // INCL_WINSOCK_API_TYPEDEFS
  2311.  
  2312. #if INCL_WINSOCK_API_PROTOTYPES
  2313. WINSOCK_API_LINKAGE
  2314. int
  2315. WSAAPI
  2316. WSAAsyncSelect(
  2317.     SOCKET s,
  2318.     HWND hWnd,
  2319.     u_int wMsg,
  2320.     long lEvent
  2321.     );
  2322. #endif // INCL_WINSOCK_API_PROTOTYPES
  2323.  
  2324. #if INCL_WINSOCK_API_TYPEDEFS
  2325. typedef
  2326. int
  2327. (WSAAPI * LPFN_WSAASYNCSELECT)(
  2328.     SOCKET s,
  2329.     HWND hWnd,
  2330.     u_int wMsg,
  2331.     long lEvent
  2332.     );
  2333. #endif // INCL_WINSOCK_API_TYPEDEFS
  2334.  
  2335. /*
  2336.  * WinSock 2 extensions -- data types for the condition function in
  2337.  * WSAAccept() and overlapped I/O completion routine.
  2338.  */
  2339.  
  2340. typedef
  2341. int
  2342. (CALLBACK * LPCONDITIONPROC)(
  2343.     LPWSABUF lpCallerId,
  2344.     LPWSABUF lpCallerData,
  2345.     LPQOS lpSQOS,
  2346.     LPQOS lpGQOS,
  2347.     LPWSABUF lpCalleeId,
  2348.     LPWSABUF lpCalleeData,
  2349.     GROUP FAR * g,
  2350.     DWORD dwCallbackData
  2351.     );
  2352.  
  2353. typedef
  2354. void
  2355. (CALLBACK * LPWSAOVERLAPPED_COMPLETION_ROUTINE)(
  2356.     DWORD dwError,
  2357.     DWORD cbTransferred,
  2358.     LPWSAOVERLAPPED lpOverlapped,
  2359.     DWORD dwFlags
  2360.     );
  2361.  
  2362. /* WinSock 2 API new function prototypes */
  2363.  
  2364. #if INCL_WINSOCK_API_PROTOTYPES
  2365. WINSOCK_API_LINKAGE
  2366. SOCKET
  2367. WSAAPI
  2368. WSAAccept(
  2369.     SOCKET s,
  2370.     struct sockaddr FAR * addr,
  2371.     LPINT addrlen,
  2372.     LPCONDITIONPROC lpfnCondition,
  2373.     DWORD dwCallbackData
  2374.     );
  2375. #endif // INCL_WINSOCK_API_PROTOTYPES
  2376.  
  2377. #if INCL_WINSOCK_API_TYPEDEFS
  2378. typedef
  2379. SOCKET
  2380. (WSAAPI * LPFN_WSAACCEPT)(
  2381.     SOCKET s,
  2382.     struct sockaddr FAR * addr,
  2383.     LPINT addrlen,
  2384.     LPCONDITIONPROC lpfnCondition,
  2385.     DWORD dwCallbackData
  2386.     );
  2387. #endif // INCL_WINSOCK_API_TYPEDEFS
  2388.  
  2389. #if INCL_WINSOCK_API_PROTOTYPES
  2390. WINSOCK_API_LINKAGE
  2391. BOOL
  2392. WSAAPI
  2393. WSACloseEvent(
  2394.     WSAEVENT hEvent
  2395.     );
  2396. #endif // INCL_WINSOCK_API_PROTOTYPES
  2397.  
  2398. #if INCL_WINSOCK_API_TYPEDEFS
  2399. typedef
  2400. BOOL
  2401. (WSAAPI * LPFN_WSACLOSEEVENT)(
  2402.     WSAEVENT hEvent
  2403.     );
  2404. #endif // INCL_WINSOCK_API_TYPEDEFS
  2405.  
  2406. #if INCL_WINSOCK_API_PROTOTYPES
  2407. WINSOCK_API_LINKAGE
  2408. int
  2409. WSAAPI
  2410. WSAConnect(
  2411.     SOCKET s,
  2412.     const struct sockaddr FAR * name,
  2413.     int namelen,
  2414.     LPWSABUF lpCallerData,
  2415.     LPWSABUF lpCalleeData,
  2416.     LPQOS lpSQOS,
  2417.     LPQOS lpGQOS
  2418.     );
  2419. #endif // INCL_WINSOCK_API_PROTOTYPES
  2420.  
  2421. #if INCL_WINSOCK_API_TYPEDEFS
  2422. typedef
  2423. int
  2424. (WSAAPI * LPFN_WSACONNECT)(
  2425.     SOCKET s,
  2426.     const struct sockaddr FAR * name,
  2427.     int namelen,
  2428.     LPWSABUF lpCallerData,
  2429.     LPWSABUF lpCalleeData,
  2430.     LPQOS lpSQOS,
  2431.     LPQOS lpGQOS
  2432.     );
  2433. #endif // INCL_WINSOCK_API_TYPEDEFS
  2434.  
  2435. #if INCL_WINSOCK_API_PROTOTYPES
  2436. WINSOCK_API_LINKAGE
  2437. WSAEVENT
  2438. WSAAPI
  2439. WSACreateEvent(
  2440.     void
  2441.     );
  2442. #endif // INCL_WINSOCK_API_PROTOTYPES
  2443.  
  2444. #if INCL_WINSOCK_API_TYPEDEFS
  2445. typedef
  2446. WSAEVENT
  2447. (WSAAPI * LPFN_WSACREATEEVENT)(
  2448.     void
  2449.     );
  2450. #endif // INCL_WINSOCK_API_TYPEDEFS
  2451.  
  2452. #if INCL_WINSOCK_API_PROTOTYPES
  2453. WINSOCK_API_LINKAGE
  2454. int
  2455. WSAAPI
  2456. WSADuplicateSocketA(
  2457.     SOCKET s,
  2458.     DWORD dwProcessId,
  2459.     LPWSAPROTOCOL_INFOA lpProtocolInfo
  2460.     );
  2461. WINSOCK_API_LINKAGE
  2462. int
  2463. WSAAPI
  2464. WSADuplicateSocketW(
  2465.     SOCKET s,
  2466.     DWORD dwProcessId,
  2467.     LPWSAPROTOCOL_INFOW lpProtocolInfo
  2468.     );
  2469. #ifdef UNICODE
  2470. #define WSADuplicateSocket  WSADuplicateSocketW
  2471. #else
  2472. #define WSADuplicateSocket  WSADuplicateSocketA
  2473. #endif // !UNICODE
  2474. #endif // INCL_WINSOCK_API_PROTOTYPES
  2475.  
  2476. #if INCL_WINSOCK_API_TYPEDEFS
  2477. typedef
  2478. int
  2479. (WSAAPI * LPFN_WSADUPLICATESOCKETA)(
  2480.     SOCKET s,
  2481.     DWORD dwProcessId,
  2482.     LPWSAPROTOCOL_INFOA lpProtocolInfo
  2483.     );
  2484. typedef
  2485. int
  2486. (WSAAPI * LPFN_WSADUPLICATESOCKETW)(
  2487.     SOCKET s,
  2488.     DWORD dwProcessId,
  2489.     LPWSAPROTOCOL_INFOW lpProtocolInfo
  2490.     );
  2491. #ifdef UNICODE
  2492. #define LPFN_WSADUPLICATESOCKET  LPFN_WSADUPLICATESOCKETW
  2493. #else
  2494. #define LPFN_WSADUPLICATESOCKET  LPFN_WSADUPLICATESOCKETA
  2495. #endif // !UNICODE
  2496. #endif // INCL_WINSOCK_API_TYPEDEFS
  2497.  
  2498. #if INCL_WINSOCK_API_PROTOTYPES
  2499. WINSOCK_API_LINKAGE
  2500. int
  2501. WSAAPI
  2502. WSAEnumNetworkEvents(
  2503.     SOCKET s,
  2504.     WSAEVENT hEventObject,
  2505.     LPWSANETWORKEVENTS lpNetworkEvents
  2506.     );
  2507. #endif // INCL_WINSOCK_API_PROTOTYPES
  2508.  
  2509. #if INCL_WINSOCK_API_TYPEDEFS
  2510. typedef
  2511. int
  2512. (WSAAPI * LPFN_WSAENUMNETWORKEVENTS)(
  2513.     SOCKET s,
  2514.     WSAEVENT hEventObject,
  2515.     LPWSANETWORKEVENTS lpNetworkEvents
  2516.     );
  2517. #endif // INCL_WINSOCK_API_TYPEDEFS
  2518.  
  2519. #if INCL_WINSOCK_API_PROTOTYPES
  2520. WINSOCK_API_LINKAGE
  2521. int
  2522. WSAAPI
  2523. WSAEnumProtocolsA(
  2524.     LPINT lpiProtocols,
  2525.     LPWSAPROTOCOL_INFOA lpProtocolBuffer,
  2526.     LPDWORD lpdwBufferLength
  2527.     );
  2528. WINSOCK_API_LINKAGE
  2529. int
  2530. WSAAPI
  2531. WSAEnumProtocolsW(
  2532.     LPINT lpiProtocols,
  2533.     LPWSAPROTOCOL_INFOW lpProtocolBuffer,
  2534.     LPDWORD lpdwBufferLength
  2535.     );
  2536. #ifdef UNICODE
  2537. #define WSAEnumProtocols  WSAEnumProtocolsW
  2538. #else
  2539. #define WSAEnumProtocols  WSAEnumProtocolsA
  2540. #endif // !UNICODE
  2541. #endif // INCL_WINSOCK_API_PROTOTYPES
  2542.  
  2543. #if INCL_WINSOCK_API_TYPEDEFS
  2544. typedef
  2545. int
  2546. (WSAAPI * LPFN_WSAENUMPROTOCOLSA)(
  2547.     LPINT lpiProtocols,
  2548.     LPWSAPROTOCOL_INFOA lpProtocolBuffer,
  2549.     LPDWORD lpdwBufferLength
  2550.     );
  2551. typedef
  2552. int
  2553. (WSAAPI * LPFN_WSAENUMPROTOCOLSW)(
  2554.     LPINT lpiProtocols,
  2555.     LPWSAPROTOCOL_INFOW lpProtocolBuffer,
  2556.     LPDWORD lpdwBufferLength
  2557.     );
  2558. #ifdef UNICODE
  2559. #define LPFN_WSAENUMPROTOCOLS  LPFN_WSAENUMPROTOCOLSW
  2560. #else
  2561. #define LPFN_WSAENUMPROTOCOLS  LPFN_WSAENUMPROTOCOLSA
  2562. #endif // !UNICODE
  2563. #endif // INCL_WINSOCK_API_TYPEDEFS
  2564.  
  2565. #if INCL_WINSOCK_API_PROTOTYPES
  2566. WINSOCK_API_LINKAGE
  2567. int
  2568. WSAAPI
  2569. WSAEventSelect(
  2570.     SOCKET s,
  2571.     WSAEVENT hEventObject,
  2572.     long lNetworkEvents
  2573.     );
  2574. #endif // INCL_WINSOCK_API_PROTOTYPES
  2575.  
  2576. #if INCL_WINSOCK_API_TYPEDEFS
  2577. typedef
  2578. int
  2579. (WSAAPI * LPFN_WSAEVENTSELECT)(
  2580.     SOCKET s,
  2581.     WSAEVENT hEventObject,
  2582.     long lNetworkEvents
  2583.     );
  2584. #endif // INCL_WINSOCK_API_TYPEDEFS
  2585.  
  2586. #if INCL_WINSOCK_API_PROTOTYPES
  2587. WINSOCK_API_LINKAGE
  2588. BOOL
  2589. WSAAPI
  2590. WSAGetOverlappedResult(
  2591.     SOCKET s,
  2592.     LPWSAOVERLAPPED lpOverlapped,
  2593.     LPDWORD lpcbTransfer,
  2594.     BOOL fWait,
  2595.     LPDWORD lpdwFlags
  2596.     );
  2597. #endif // INCL_WINSOCK_API_PROTOTYPES
  2598.  
  2599. #if INCL_WINSOCK_API_TYPEDEFS
  2600. typedef
  2601. BOOL
  2602. (WSAAPI * LPFN_WSAGETOVERLAPPEDRESULT)(
  2603.     SOCKET s,
  2604.     LPWSAOVERLAPPED lpOverlapped,
  2605.     LPDWORD lpcbTransfer,
  2606.     BOOL fWait,
  2607.     LPDWORD lpdwFlags
  2608.     );
  2609. #endif // INCL_WINSOCK_API_TYPEDEFS
  2610.  
  2611. #if INCL_WINSOCK_API_PROTOTYPES
  2612. WINSOCK_API_LINKAGE
  2613. BOOL
  2614. WSAAPI
  2615. WSAGetQOSByName(
  2616.     SOCKET s,
  2617.     LPWSABUF lpQOSName,
  2618.     LPQOS lpQOS
  2619.     );
  2620. #endif // INCL_WINSOCK_API_PROTOTYPES
  2621.  
  2622. #if INCL_WINSOCK_API_TYPEDEFS
  2623. typedef
  2624. BOOL
  2625. (WSAAPI * LPFN_WSAGETQOSBYNAME)(
  2626.     SOCKET s,
  2627.     LPWSABUF lpQOSName,
  2628.     LPQOS lpQOS
  2629.     );
  2630. #endif // INCL_WINSOCK_API_TYPEDEFS
  2631.  
  2632. #if INCL_WINSOCK_API_PROTOTYPES
  2633. WINSOCK_API_LINKAGE
  2634. int
  2635. WSAAPI
  2636. WSAHtonl(
  2637.     SOCKET s,
  2638.     u_long hostlong,
  2639.     u_long FAR * lpnetlong
  2640.     );
  2641. #endif // INCL_WINSOCK_API_PROTOTYPES
  2642.  
  2643. #if INCL_WINSOCK_API_TYPEDEFS
  2644. typedef
  2645. int
  2646. (WSAAPI * LPFN_WSAHTONL)(
  2647.     SOCKET s,
  2648.     u_long hostlong,
  2649.     u_long FAR * lpnetlong
  2650.     );
  2651. #endif // INCL_WINSOCK_API_TYPEDEFS
  2652.  
  2653. #if INCL_WINSOCK_API_PROTOTYPES
  2654. WINSOCK_API_LINKAGE
  2655. int
  2656. WSAAPI
  2657. WSAHtons(
  2658.     SOCKET s,
  2659.     u_short hostshort,
  2660.     u_short FAR * lpnetshort
  2661.     );
  2662. #endif // INCL_WINSOCK_API_PROTOTYPES
  2663.  
  2664. #if INCL_WINSOCK_API_TYPEDEFS
  2665. typedef
  2666. int
  2667. (WSAAPI * LPFN_WSAHTONS)(
  2668.     SOCKET s,
  2669.     u_short hostshort,
  2670.     u_short FAR * lpnetshort
  2671.     );
  2672. #endif // INCL_WINSOCK_API_TYPEDEFS
  2673.  
  2674. #if INCL_WINSOCK_API_PROTOTYPES
  2675. WINSOCK_API_LINKAGE
  2676. int
  2677. WSAAPI
  2678. WSAIoctl(
  2679.     SOCKET s,
  2680.     DWORD dwIoControlCode,
  2681.     LPVOID lpvInBuffer,
  2682.     DWORD cbInBuffer,
  2683.     LPVOID lpvOutBuffer,
  2684.     DWORD cbOutBuffer,
  2685.     LPDWORD lpcbBytesReturned,
  2686.     LPWSAOVERLAPPED lpOverlapped,
  2687.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2688.     );
  2689. #endif // INCL_WINSOCK_API_PROTOTYPES
  2690.  
  2691. #if INCL_WINSOCK_API_TYPEDEFS
  2692. typedef
  2693. int
  2694. (WSAAPI * LPFN_WSAIOCTL)(
  2695.     SOCKET s,
  2696.     DWORD dwIoControlCode,
  2697.     LPVOID lpvInBuffer,
  2698.     DWORD cbInBuffer,
  2699.     LPVOID lpvOutBuffer,
  2700.     DWORD cbOutBuffer,
  2701.     LPDWORD lpcbBytesReturned,
  2702.     LPWSAOVERLAPPED lpOverlapped,
  2703.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2704.     );
  2705. #endif // INCL_WINSOCK_API_TYPEDEFS
  2706.  
  2707. #if INCL_WINSOCK_API_PROTOTYPES
  2708. WINSOCK_API_LINKAGE
  2709. SOCKET
  2710. WSAAPI
  2711. WSAJoinLeaf(
  2712.     SOCKET s,
  2713.     const struct sockaddr FAR * name,
  2714.     int namelen,
  2715.     LPWSABUF lpCallerData,
  2716.     LPWSABUF lpCalleeData,
  2717.     LPQOS lpSQOS,
  2718.     LPQOS lpGQOS,
  2719.     DWORD dwFlags
  2720.     );
  2721. #endif // INCL_WINSOCK_API_PROTOTYPES
  2722.  
  2723. #if INCL_WINSOCK_API_TYPEDEFS
  2724. typedef
  2725. SOCKET
  2726. (WSAAPI * LPFN_WSAJOINLEAF)(
  2727.     SOCKET s,
  2728.     const struct sockaddr FAR * name,
  2729.     int namelen,
  2730.     LPWSABUF lpCallerData,
  2731.     LPWSABUF lpCalleeData,
  2732.     LPQOS lpSQOS,
  2733.     LPQOS lpGQOS,
  2734.     DWORD dwFlags
  2735.     );
  2736. #endif // INCL_WINSOCK_API_TYPEDEFS
  2737.  
  2738. #if INCL_WINSOCK_API_PROTOTYPES
  2739. WINSOCK_API_LINKAGE
  2740. int
  2741. WSAAPI
  2742. WSANtohl(
  2743.     SOCKET s,
  2744.     u_long netlong,
  2745.     u_long FAR * lphostlong
  2746.     );
  2747. #endif // INCL_WINSOCK_API_PROTOTYPES
  2748.  
  2749. #if INCL_WINSOCK_API_TYPEDEFS
  2750. typedef
  2751. int
  2752. (WSAAPI * LPFN_WSANTOHL)(
  2753.     SOCKET s,
  2754.     u_long netlong,
  2755.     u_long FAR * lphostlong
  2756.     );
  2757. #endif // INCL_WINSOCK_API_TYPEDEFS
  2758.  
  2759. #if INCL_WINSOCK_API_PROTOTYPES
  2760. WINSOCK_API_LINKAGE
  2761. int
  2762. WSAAPI
  2763. WSANtohs(
  2764.     SOCKET s,
  2765.     u_short netshort,
  2766.     u_short FAR * lphostshort
  2767.     );
  2768. #endif // INCL_WINSOCK_API_PROTOTYPES
  2769.  
  2770. #if INCL_WINSOCK_API_TYPEDEFS
  2771. typedef
  2772. int
  2773. (WSAAPI * LPFN_WSANTOHS)(
  2774.     SOCKET s,
  2775.     u_short netshort,
  2776.     u_short FAR * lphostshort
  2777.     );
  2778. #endif // INCL_WINSOCK_API_TYPEDEFS
  2779.  
  2780. #if INCL_WINSOCK_API_PROTOTYPES
  2781. WINSOCK_API_LINKAGE
  2782. int
  2783. WSAAPI
  2784. WSARecv(
  2785.     SOCKET s,
  2786.     LPWSABUF lpBuffers,
  2787.     DWORD dwBufferCount,
  2788.     LPDWORD lpNumberOfBytesRecvd,
  2789.     LPDWORD lpFlags,
  2790.     LPWSAOVERLAPPED lpOverlapped,
  2791.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2792.     );
  2793. #endif // INCL_WINSOCK_API_PROTOTYPES
  2794.  
  2795. #if INCL_WINSOCK_API_TYPEDEFS
  2796. typedef
  2797. int
  2798. (WSAAPI * LPFN_WSARECV)(
  2799.     SOCKET s,
  2800.     LPWSABUF lpBuffers,
  2801.     DWORD dwBufferCount,
  2802.     LPDWORD lpNumberOfBytesRecvd,
  2803.     LPDWORD lpFlags,
  2804.     LPWSAOVERLAPPED lpOverlapped,
  2805.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2806.     );
  2807. #endif // INCL_WINSOCK_API_TYPEDEFS
  2808.  
  2809. #if INCL_WINSOCK_API_PROTOTYPES
  2810. WINSOCK_API_LINKAGE
  2811. int
  2812. WSAAPI
  2813. WSARecvDisconnect(
  2814.     SOCKET s,
  2815.     LPWSABUF lpInboundDisconnectData
  2816.     );
  2817. #endif // INCL_WINSOCK_API_PROTOTYPES
  2818.  
  2819. #if INCL_WINSOCK_API_TYPEDEFS
  2820. typedef
  2821. int
  2822. (WSAAPI * LPFN_WSARECVDISCONNECT)(
  2823.     SOCKET s,
  2824.     LPWSABUF lpInboundDisconnectData
  2825.     );
  2826. #endif // INCL_WINSOCK_API_TYPEDEFS
  2827.  
  2828. #if INCL_WINSOCK_API_PROTOTYPES
  2829. WINSOCK_API_LINKAGE
  2830. int
  2831. WSAAPI
  2832. WSARecvFrom(
  2833.     SOCKET s,
  2834.     LPWSABUF lpBuffers,
  2835.     DWORD dwBufferCount,
  2836.     LPDWORD lpNumberOfBytesRecvd,
  2837.     LPDWORD lpFlags,
  2838.     struct sockaddr FAR * lpFrom,
  2839.     LPINT lpFromlen,
  2840.     LPWSAOVERLAPPED lpOverlapped,
  2841.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2842.     );
  2843. #endif // INCL_WINSOCK_API_PROTOTYPES
  2844.  
  2845. #if INCL_WINSOCK_API_TYPEDEFS
  2846. typedef
  2847. int
  2848. (WSAAPI * LPFN_WSARECVFROM)(
  2849.     SOCKET s,
  2850.     LPWSABUF lpBuffers,
  2851.     DWORD dwBufferCount,
  2852.     LPDWORD lpNumberOfBytesRecvd,
  2853.     LPDWORD lpFlags,
  2854.     struct sockaddr FAR * lpFrom,
  2855.     LPINT lpFromlen,
  2856.     LPWSAOVERLAPPED lpOverlapped,
  2857.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2858.     );
  2859. #endif // INCL_WINSOCK_API_TYPEDEFS
  2860.  
  2861. #if INCL_WINSOCK_API_PROTOTYPES
  2862. WINSOCK_API_LINKAGE
  2863. BOOL
  2864. WSAAPI
  2865. WSAResetEvent(
  2866.     WSAEVENT hEvent
  2867.     );
  2868. #endif // INCL_WINSOCK_API_PROTOTYPES
  2869.  
  2870. #if INCL_WINSOCK_API_TYPEDEFS
  2871. typedef
  2872. BOOL
  2873. (WSAAPI * LPFN_WSARESETEVENT)(
  2874.     WSAEVENT hEvent
  2875.     );
  2876. #endif // INCL_WINSOCK_API_TYPEDEFS
  2877.  
  2878. #if INCL_WINSOCK_API_PROTOTYPES
  2879. WINSOCK_API_LINKAGE
  2880. int
  2881. WSAAPI
  2882. WSASend(
  2883.     SOCKET s,
  2884.     LPWSABUF lpBuffers,
  2885.     DWORD dwBufferCount,
  2886.     LPDWORD lpNumberOfBytesSent,
  2887.     DWORD dwFlags,
  2888.     LPWSAOVERLAPPED lpOverlapped,
  2889.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2890.     );
  2891. #endif // INCL_WINSOCK_API_PROTOTYPES
  2892.  
  2893. #if INCL_WINSOCK_API_TYPEDEFS
  2894. typedef
  2895. int
  2896. (WSAAPI * LPFN_WSASEND)(
  2897.     SOCKET s,
  2898.     LPWSABUF lpBuffers,
  2899.     DWORD dwBufferCount,
  2900.     LPDWORD lpNumberOfBytesSent,
  2901.     DWORD dwFlags,
  2902.     LPWSAOVERLAPPED lpOverlapped,
  2903.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2904.     );
  2905. #endif // INCL_WINSOCK_API_TYPEDEFS
  2906.  
  2907. #if INCL_WINSOCK_API_PROTOTYPES
  2908. WINSOCK_API_LINKAGE
  2909. int
  2910. WSAAPI
  2911. WSASendDisconnect(
  2912.     SOCKET s,
  2913.     LPWSABUF lpOutboundDisconnectData
  2914.     );
  2915. #endif // INCL_WINSOCK_API_PROTOTYPES
  2916.  
  2917. #if INCL_WINSOCK_API_TYPEDEFS
  2918. typedef
  2919. int
  2920. (WSAAPI * LPFN_WSASENDDISCONNECT)(
  2921.     SOCKET s,
  2922.     LPWSABUF lpOutboundDisconnectData
  2923.     );
  2924. #endif // INCL_WINSOCK_API_TYPEDEFS
  2925.  
  2926. #if INCL_WINSOCK_API_PROTOTYPES
  2927. WINSOCK_API_LINKAGE
  2928. int
  2929. WSAAPI
  2930. WSASendTo(
  2931.     SOCKET s,
  2932.     LPWSABUF lpBuffers,
  2933.     DWORD dwBufferCount,
  2934.     LPDWORD lpNumberOfBytesSent,
  2935.     DWORD dwFlags,
  2936.     const struct sockaddr FAR * lpTo,
  2937.     int iTolen,
  2938.     LPWSAOVERLAPPED lpOverlapped,
  2939.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2940.     );
  2941. #endif // INCL_WINSOCK_API_PROTOTYPES
  2942.  
  2943. #if INCL_WINSOCK_API_TYPEDEFS
  2944. typedef
  2945. int
  2946. (WSAAPI * LPFN_WSASENDTO)(
  2947.     SOCKET s,
  2948.     LPWSABUF lpBuffers,
  2949.     DWORD dwBufferCount,
  2950.     LPDWORD lpNumberOfBytesSent,
  2951.     DWORD dwFlags,
  2952.     const struct sockaddr FAR * lpTo,
  2953.     int iTolen,
  2954.     LPWSAOVERLAPPED lpOverlapped,
  2955.     LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
  2956.     );
  2957. #endif // INCL_WINSOCK_API_TYPEDEFS
  2958.  
  2959. #if INCL_WINSOCK_API_PROTOTYPES
  2960. WINSOCK_API_LINKAGE
  2961. BOOL
  2962. WSAAPI
  2963. WSASetEvent(
  2964.     WSAEVENT hEvent
  2965.     );
  2966. #endif // INCL_WINSOCK_API_PROTOTYPES
  2967.  
  2968. #if INCL_WINSOCK_API_TYPEDEFS
  2969. typedef
  2970. BOOL
  2971. (WSAAPI * LPFN_WSASETEVENT)(
  2972.     WSAEVENT hEvent
  2973.     );
  2974. #endif // INCL_WINSOCK_API_TYPEDEFS
  2975.  
  2976. #if INCL_WINSOCK_API_PROTOTYPES
  2977. WINSOCK_API_LINKAGE
  2978. SOCKET
  2979. WSAAPI
  2980. WSASocketA(
  2981.     int af,
  2982.     int type,
  2983.     int protocol,
  2984.     LPWSAPROTOCOL_INFOA lpProtocolInfo,
  2985.     GROUP g,
  2986.     DWORD dwFlags
  2987.     );
  2988. WINSOCK_API_LINKAGE
  2989. SOCKET
  2990. WSAAPI
  2991. WSASocketW(
  2992.     int af,
  2993.     int type,
  2994.     int protocol,
  2995.     LPWSAPROTOCOL_INFOW lpProtocolInfo,
  2996.     GROUP g,
  2997.     DWORD dwFlags
  2998.     );
  2999. #ifdef UNICODE
  3000. #define WSASocket  WSASocketW
  3001. #else
  3002. #define WSASocket  WSASocketA
  3003. #endif // !UNICODE
  3004. #endif // INCL_WINSOCK_API_PROTOTYPES
  3005.  
  3006. #if INCL_WINSOCK_API_TYPEDEFS
  3007. typedef
  3008. SOCKET
  3009. (WSAAPI * LPFN_WSASOCKETA)(
  3010.     int af,
  3011.     int type,
  3012.     int protocol,
  3013.     LPWSAPROTOCOL_INFOA lpProtocolInfo,
  3014.     GROUP g,
  3015.     DWORD dwFlags
  3016.     );
  3017. typedef
  3018. SOCKET
  3019. (WSAAPI * LPFN_WSASOCKETW)(
  3020.     int af,
  3021.     int type,
  3022.     int protocol,
  3023.     LPWSAPROTOCOL_INFOW lpProtocolInfo,
  3024.     GROUP g,
  3025.     DWORD dwFlags
  3026.     );
  3027. #ifdef UNICODE
  3028. #define LPFN_WSASOCKET  LPFN_WSASOCKETW
  3029. #else
  3030. #define LPFN_WSASOCKET  LPFN_WSASOCKETA
  3031. #endif // !UNICODE
  3032. #endif // INCL_WINSOCK_API_TYPEDEFS
  3033.  
  3034. #if INCL_WINSOCK_API_PROTOTYPES
  3035. WINSOCK_API_LINKAGE
  3036. DWORD
  3037. WSAAPI
  3038. WSAWaitForMultipleEvents(
  3039.     DWORD cEvents,
  3040.     const WSAEVENT FAR * lphEvents,
  3041.     BOOL fWaitAll,
  3042.     DWORD dwTimeout,
  3043.     BOOL fAlertable
  3044.     );
  3045. #endif // INCL_WINSOCK_API_PROTOTYPES
  3046.  
  3047. #if INCL_WINSOCK_API_TYPEDEFS
  3048. typedef
  3049. DWORD
  3050. (WSAAPI * LPFN_WSAWAITFORMULTIPLEEVENTS)(
  3051.     DWORD cEvents,
  3052.     const WSAEVENT FAR * lphEvents,
  3053.     BOOL fWaitAll,
  3054.     DWORD dwTimeout,
  3055.     BOOL fAlertable
  3056.     );
  3057. #endif // INCL_WINSOCK_API_TYPEDEFS
  3058.  
  3059. #if INCL_WINSOCK_API_PROTOTYPES
  3060. WINSOCK_API_LINKAGE
  3061. INT
  3062. WSAAPI
  3063. WSAAddressToStringA(
  3064.     IN     LPSOCKADDR          lpsaAddress,
  3065.     IN     DWORD               dwAddressLength,
  3066.     IN     LPWSAPROTOCOL_INFOA lpProtocolInfo,
  3067.     IN OUT LPSTR             lpszAddressString,
  3068.     IN OUT LPDWORD             lpdwAddressStringLength
  3069.     );
  3070. WINSOCK_API_LINKAGE
  3071. INT
  3072. WSAAPI
  3073. WSAAddressToStringW(
  3074.     IN     LPSOCKADDR          lpsaAddress,
  3075.     IN     DWORD               dwAddressLength,
  3076.     IN     LPWSAPROTOCOL_INFOW lpProtocolInfo,
  3077.     IN OUT LPWSTR             lpszAddressString,
  3078.     IN OUT LPDWORD             lpdwAddressStringLength
  3079.     );
  3080. #ifdef UNICODE
  3081. #define WSAAddressToString  WSAAddressToStringW
  3082. #else
  3083. #define WSAAddressToString  WSAAddressToStringA
  3084. #endif // !UNICODE
  3085. #endif // INCL_WINSOCK_API_PROTOTYPES
  3086.  
  3087. #if INCL_WINSOCK_API_TYPEDEFS
  3088. typedef
  3089. INT
  3090. (WSAAPI * LPFN_WSAADDRESSTOSTRINGA)(
  3091.     IN     LPSOCKADDR          lpsaAddress,
  3092.     IN     DWORD               dwAddressLength,
  3093.     IN     LPWSAPROTOCOL_INFOA lpProtocolInfo,
  3094.     IN OUT LPSTR             lpszAddressString,
  3095.     IN OUT LPDWORD             lpdwAddressStringLength
  3096.     );
  3097. typedef
  3098. INT
  3099. (WSAAPI * LPFN_WSAADDRESSTOSTRINGW)(
  3100.     IN     LPSOCKADDR          lpsaAddress,
  3101.     IN     DWORD               dwAddressLength,
  3102.     IN     LPWSAPROTOCOL_INFOW lpProtocolInfo,
  3103.     IN OUT LPWSTR             lpszAddressString,
  3104.     IN OUT LPDWORD             lpdwAddressStringLength
  3105.     );
  3106. #ifdef UNICODE
  3107. #define LPFN_WSAADDRESSTOSTRING  LPFN_WSAADDRESSTOSTRINGW
  3108. #else
  3109. #define LPFN_WSAADDRESSTOSTRING  LPFN_WSAADDRESSTOSTRINGA
  3110. #endif // !UNICODE
  3111. #endif // INCL_WINSOCK_API_TYPEDEFS
  3112.  
  3113. #if INCL_WINSOCK_API_PROTOTYPES
  3114. WINSOCK_API_LINKAGE
  3115. INT
  3116. WSAAPI
  3117. WSAStringToAddressA(
  3118.     IN     LPSTR             AddressString,
  3119.     IN     INT                 AddressFamily,
  3120.     IN     LPWSAPROTOCOL_INFOA lpProtocolInfo,
  3121.     IN OUT LPSOCKADDR          lpAddress,
  3122.     IN OUT LPINT               lpAddressLength
  3123.     );
  3124. WINSOCK_API_LINKAGE
  3125. INT
  3126. WSAAPI
  3127. WSAStringToAddressW(
  3128.     IN     LPWSTR             AddressString,
  3129.     IN     INT                 AddressFamily,
  3130.     IN     LPWSAPROTOCOL_INFOW lpProtocolInfo,
  3131.     IN OUT LPSOCKADDR          lpAddress,
  3132.     IN OUT LPINT               lpAddressLength
  3133.     );
  3134. #ifdef UNICODE
  3135. #define WSAStringToAddress  WSAStringToAddressW
  3136. #else
  3137. #define WSAStringToAddress  WSAStringToAddressA
  3138. #endif // !UNICODE
  3139. #endif // INCL_WINSOCK_API_PROTOTYPES
  3140.  
  3141. #if INCL_WINSOCK_API_TYPEDEFS
  3142. typedef
  3143. INT
  3144. (WSAAPI * LPFN_WSASTRINGTOADDRESSA)(
  3145.     IN     LPSTR             AddressString,
  3146.     IN     INT                 AddressFamily,
  3147.     IN     LPWSAPROTOCOL_INFOA lpProtocolInfo,
  3148.     IN OUT LPSOCKADDR          lpAddress,
  3149.     IN OUT LPINT               lpAddressLength
  3150.     );
  3151. typedef
  3152. INT
  3153. (WSAAPI * LPFN_WSASTRINGTOADDRESSW)(
  3154.     IN     LPWSTR             AddressString,
  3155.     IN     INT                 AddressFamily,
  3156.     IN     LPWSAPROTOCOL_INFOW lpProtocolInfo,
  3157.     IN OUT LPSOCKADDR          lpAddress,
  3158.     IN OUT LPINT               lpAddressLength
  3159.     );
  3160. #ifdef UNICODE
  3161. #define LPFN_WSASTRINGTOADDRESS  LPFN_WSASTRINGTOADDRESSW
  3162. #else
  3163. #define LPFN_WSASTRINGTOADDRESS  LPFN_WSASTRINGTOADDRESSA
  3164. #endif // !UNICODE
  3165. #endif // INCL_WINSOCK_API_TYPEDEFS
  3166.  
  3167. /* Registration and Name Resolution API functions */
  3168.  
  3169.  
  3170. #if INCL_WINSOCK_API_PROTOTYPES
  3171. WINSOCK_API_LINKAGE
  3172. INT
  3173. WSAAPI
  3174. WSALookupServiceBeginA(
  3175.     IN  LPWSAQUERYSETA lpqsRestrictions,
  3176.     IN  DWORD          dwControlFlags,
  3177.     OUT LPHANDLE       lphLookup
  3178.     );
  3179. WINSOCK_API_LINKAGE
  3180. INT
  3181. WSAAPI
  3182. WSALookupServiceBeginW(
  3183.     IN  LPWSAQUERYSETW lpqsRestrictions,
  3184.     IN  DWORD          dwControlFlags,
  3185.     OUT LPHANDLE       lphLookup
  3186.     );
  3187. #ifdef UNICODE
  3188. #define WSALookupServiceBegin  WSALookupServiceBeginW
  3189. #else
  3190. #define WSALookupServiceBegin  WSALookupServiceBeginA
  3191. #endif // !UNICODE
  3192. #endif // INCL_WINSOCK_API_PROTOTYPES
  3193.  
  3194. #if INCL_WINSOCK_API_TYPEDEFS
  3195. typedef
  3196. INT
  3197. (WSAAPI * LPFN_WSALOOKUPSERVICEBEGINA)(
  3198.     IN  LPWSAQUERYSETA lpqsRestrictions,
  3199.     IN  DWORD          dwControlFlags,
  3200.     OUT LPHANDLE       lphLookup
  3201.     );
  3202. typedef
  3203. INT
  3204. (WSAAPI * LPFN_WSALOOKUPSERVICEBEGINW)(
  3205.     IN  LPWSAQUERYSETW lpqsRestrictions,
  3206.     IN  DWORD          dwControlFlags,
  3207.     OUT LPHANDLE       lphLookup
  3208.     );
  3209. #ifdef UNICODE
  3210. #define LPFN_WSALOOKUPSERVICEBEGIN  LPFN_WSALOOKUPSERVICEBEGINW
  3211. #else
  3212. #define LPFN_WSALOOKUPSERVICEBEGIN  LPFN_WSALOOKUPSERVICEBEGINA
  3213. #endif // !UNICODE
  3214. #endif // INCL_WINSOCK_API_TYPEDEFS
  3215.  
  3216. #if INCL_WINSOCK_API_PROTOTYPES
  3217. WINSOCK_API_LINKAGE
  3218. INT
  3219. WSAAPI
  3220. WSALookupServiceNextA(
  3221.     IN     HANDLE           hLookup,
  3222.     IN     DWORD            dwControlFlags,
  3223.     IN OUT LPDWORD          lpdwBufferLength,
  3224.     OUT    LPWSAQUERYSETA   lpqsResults
  3225.     );
  3226. WINSOCK_API_LINKAGE
  3227. INT
  3228. WSAAPI
  3229. WSALookupServiceNextW(
  3230.     IN     HANDLE           hLookup,
  3231.     IN     DWORD            dwControlFlags,
  3232.     IN OUT LPDWORD          lpdwBufferLength,
  3233.     OUT    LPWSAQUERYSETW   lpqsResults
  3234.     );
  3235. #ifdef UNICODE
  3236. #define WSALookupServiceNext  WSALookupServiceNextW
  3237. #else
  3238. #define WSALookupServiceNext  WSALookupServiceNextA
  3239. #endif // !UNICODE
  3240. #endif // INCL_WINSOCK_API_PROTOTYPES
  3241.  
  3242. #if INCL_WINSOCK_API_TYPEDEFS
  3243. typedef
  3244. INT
  3245. (WSAAPI * LPFN_WSALOOKUPSERVICENEXTA)(
  3246.     IN     HANDLE           hLookup,
  3247.     IN     DWORD            dwControlFlags,
  3248.     IN OUT LPDWORD          lpdwBufferLength,
  3249.     OUT    LPWSAQUERYSETA   lpqsResults
  3250.     );
  3251. typedef
  3252. INT
  3253. (WSAAPI * LPFN_WSALOOKUPSERVICENEXTW)(
  3254.     IN     HANDLE           hLookup,
  3255.     IN     DWORD            dwControlFlags,
  3256.     IN OUT LPDWORD          lpdwBufferLength,
  3257.     OUT    LPWSAQUERYSETW   lpqsResults
  3258.     );
  3259. #ifdef UNICODE
  3260. #define LPFN_WSALOOKUPSERVICENEXT  LPFN_WSALOOKUPSERVICENEXTW
  3261. #else
  3262. #define LPFN_WSALOOKUPSERVICENEXT  LPFN_WSALOOKUPSERVICENEXTA
  3263. #endif // !UNICODE
  3264. #endif // INCL_WINSOCK_API_TYPEDEFS
  3265.  
  3266. #if INCL_WINSOCK_API_PROTOTYPES
  3267. WINSOCK_API_LINKAGE
  3268. INT
  3269. WSAAPI
  3270. WSALookupServiceEnd(
  3271.     IN HANDLE  hLookup
  3272.     );
  3273. #endif // INCL_WINSOCK_API_PROTOTYPES
  3274.  
  3275. #if INCL_WINSOCK_API_TYPEDEFS
  3276. typedef
  3277. INT
  3278. (WSAAPI * LPFN_WSALOOKUPSERVICEEND)(
  3279.     IN HANDLE  hLookup
  3280.     );
  3281. #endif // INCL_WINSOCK_API_TYPEDEFS
  3282.  
  3283. #if INCL_WINSOCK_API_PROTOTYPES
  3284. WINSOCK_API_LINKAGE
  3285. INT
  3286. WSAAPI
  3287. WSAInstallServiceClassA(
  3288.     IN  LPWSASERVICECLASSINFOA   lpServiceClassInfo
  3289.     );
  3290. WINSOCK_API_LINKAGE
  3291. INT
  3292. WSAAPI
  3293. WSAInstallServiceClassW(
  3294.     IN  LPWSASERVICECLASSINFOW   lpServiceClassInfo
  3295.     );
  3296. #ifdef UNICODE
  3297. #define WSAInstallServiceClass  WSAInstallServiceClassW
  3298. #else
  3299. #define WSAInstallServiceClass  WSAInstallServiceClassA
  3300. #endif // !UNICODE
  3301. #endif // INCL_WINSOCK_API_PROTOTYPES
  3302.  
  3303. #if INCL_WINSOCK_API_TYPEDEFS
  3304. typedef
  3305. INT
  3306. (WSAAPI * LPFN_WSAINSTALLSERVICECLASSA)(
  3307.     IN  LPWSASERVICECLASSINFOA   lpServiceClassInfo
  3308.     );
  3309. typedef
  3310. INT
  3311. (WSAAPI * LPFN_WSAINSTALLSERVICECLASSW)(
  3312.     IN  LPWSASERVICECLASSINFOW   lpServiceClassInfo
  3313.     );
  3314. #ifdef UNICODE
  3315. #define LPFN_WSAINSTALLSERVICECLASS  LPFN_WSAINSTALLSERVICECLASSW
  3316. #else
  3317. #define LPFN_WSAINSTALLSERVICECLASS  LPFN_WSAINSTALLSERVICECLASSA
  3318. #endif // !UNICODE
  3319. #endif // INCL_WINSOCK_API_TYPEDEFS
  3320.  
  3321. #if INCL_WINSOCK_API_PROTOTYPES
  3322. WINSOCK_API_LINKAGE
  3323. INT
  3324. WSAAPI
  3325. WSARemoveServiceClass(
  3326.     IN  LPGUID  lpServiceClassId
  3327.     );
  3328. #endif // INCL_WINSOCK_API_PROTOTYPES
  3329.  
  3330. #if INCL_WINSOCK_API_TYPEDEFS
  3331. typedef
  3332. INT
  3333. (WSAAPI * LPFN_WSAREMOVESERVICECLASS)(
  3334.     IN  LPGUID  lpServiceClassId
  3335.     );
  3336. #endif // INCL_WINSOCK_API_TYPEDEFS
  3337.  
  3338. #if INCL_WINSOCK_API_PROTOTYPES
  3339. WINSOCK_API_LINKAGE
  3340. INT
  3341. WSAAPI
  3342. WSAGetServiceClassInfoA(
  3343.     IN  LPGUID  lpProviderId,
  3344.     IN  LPGUID  lpServiceClassId,
  3345.     IN OUT LPDWORD  lpdwBufSize,
  3346.     OUT LPWSASERVICECLASSINFOA lpServiceClassInfo
  3347.     );
  3348. WINSOCK_API_LINKAGE
  3349. INT
  3350. WSAAPI
  3351. WSAGetServiceClassInfoW(
  3352.     IN  LPGUID  lpProviderId,
  3353.     IN  LPGUID  lpServiceClassId,
  3354.     IN OUT LPDWORD  lpdwBufSize,
  3355.     OUT LPWSASERVICECLASSINFOW lpServiceClassInfo
  3356.     );
  3357. #ifdef UNICODE
  3358. #define WSAGetServiceClassInfo  WSAGetServiceClassInfoW
  3359. #else
  3360. #define WSAGetServiceClassInfo  WSAGetServiceClassInfoA
  3361. #endif // !UNICODE
  3362. #endif // INCL_WINSOCK_API_PROTOTYPES
  3363.  
  3364. #if INCL_WINSOCK_API_TYPEDEFS
  3365. typedef
  3366. INT
  3367. (WSAAPI * LPFN_WSAGETSERVICECLASSINFOA)(
  3368.     IN  LPGUID  lpProviderId,
  3369.     IN  LPGUID  lpServiceClassId,
  3370.     IN OUT LPDWORD  lpdwBufSize,
  3371.     OUT LPWSASERVICECLASSINFOA lpServiceClassInfo
  3372.     );
  3373. typedef
  3374. INT
  3375. (WSAAPI * LPFN_WSAGETSERVICECLASSINFOW)(
  3376.     IN  LPGUID  lpProviderId,
  3377.     IN  LPGUID  lpServiceClassId,
  3378.     IN OUT LPDWORD  lpdwBufSize,
  3379.     OUT LPWSASERVICECLASSINFOW lpServiceClassInfo
  3380.     );
  3381. #ifdef UNICODE
  3382. #define LPFN_WSAGETSERVICECLASSINFO  LPFN_WSAGETSERVICECLASSINFOW
  3383. #else
  3384. #define LPFN_WSAGETSERVICECLASSINFO  LPFN_WSAGETSERVICECLASSINFOA
  3385. #endif // !UNICODE
  3386. #endif // INCL_WINSOCK_API_TYPEDEFS
  3387.  
  3388. #if INCL_WINSOCK_API_PROTOTYPES
  3389. WINSOCK_API_LINKAGE
  3390. INT
  3391. WSAAPI
  3392. WSAEnumNameSpaceProvidersA(
  3393.     IN OUT LPDWORD              lpdwBufferLength,
  3394.     IN     LPWSANAMESPACE_INFOA lpnspBuffer
  3395.     );
  3396. WINSOCK_API_LINKAGE
  3397. INT
  3398. WSAAPI
  3399. WSAEnumNameSpaceProvidersW(
  3400.     IN OUT LPDWORD              lpdwBufferLength,
  3401.     IN     LPWSANAMESPACE_INFOW lpnspBuffer
  3402.     );
  3403. #ifdef UNICODE
  3404. #define WSAEnumNameSpaceProviders  WSAEnumNameSpaceProvidersW
  3405. #else
  3406. #define WSAEnumNameSpaceProviders  WSAEnumNameSpaceProvidersA
  3407. #endif // !UNICODE
  3408. #endif // INCL_WINSOCK_API_PROTOTYPES
  3409.  
  3410. #if INCL_WINSOCK_API_TYPEDEFS
  3411. typedef
  3412. INT
  3413. (WSAAPI * LPFN_WSAENUMNAMESPACEPROVIDERSA)(
  3414.     IN OUT LPDWORD              lpdwBufferLength,
  3415.     IN     LPWSANAMESPACE_INFOA lpnspBuffer
  3416.     );
  3417. typedef
  3418. INT
  3419. (WSAAPI * LPFN_WSAENUMNAMESPACEPROVIDERSW)(
  3420.     IN OUT LPDWORD              lpdwBufferLength,
  3421.     IN     LPWSANAMESPACE_INFOW lpnspBuffer
  3422.     );
  3423. #ifdef UNICODE
  3424. #define LPFN_WSAENUMNAMESPACEPROVIDERS  LPFN_WSAENUMNAMESPACEPROVIDERSW
  3425. #else
  3426. #define LPFN_WSAENUMNAMESPACEPROVIDERS  LPFN_WSAENUMNAMESPACEPROVIDERSA
  3427. #endif // !UNICODE
  3428. #endif // INCL_WINSOCK_API_TYPEDEFS
  3429.  
  3430. #if INCL_WINSOCK_API_PROTOTYPES
  3431. WINSOCK_API_LINKAGE
  3432. INT
  3433. WSAAPI
  3434. WSAGetServiceClassNameByClassIdA(
  3435.     IN      LPGUID  lpServiceClassId,
  3436.     OUT     LPSTR lpszServiceClassName,
  3437.     IN OUT  LPDWORD lpdwBufferLength
  3438.     );
  3439. WINSOCK_API_LINKAGE
  3440. INT
  3441. WSAAPI
  3442. WSAGetServiceClassNameByClassIdW(
  3443.     IN      LPGUID  lpServiceClassId,
  3444.     OUT     LPWSTR lpszServiceClassName,
  3445.     IN OUT  LPDWORD lpdwBufferLength
  3446.     );
  3447. #ifdef UNICODE
  3448. #define WSAGetServiceClassNameByClassId  WSAGetServiceClassNameByClassIdW
  3449. #else
  3450. #define WSAGetServiceClassNameByClassId  WSAGetServiceClassNameByClassIdA
  3451. #endif // !UNICODE
  3452. #endif // INCL_WINSOCK_API_PROTOTYPES
  3453.  
  3454. #if INCL_WINSOCK_API_TYPEDEFS
  3455. typedef
  3456. INT
  3457. (WSAAPI * LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(
  3458.     IN      LPGUID  lpServiceClassId,
  3459.     OUT     LPSTR lpszServiceClassName,
  3460.     IN OUT  LPDWORD lpdwBufferLength
  3461.     );
  3462. typedef
  3463. INT
  3464. (WSAAPI * LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(
  3465.     IN      LPGUID  lpServiceClassId,
  3466.     OUT     LPWSTR lpszServiceClassName,
  3467.     IN OUT  LPDWORD lpdwBufferLength
  3468.     );
  3469. #ifdef UNICODE
  3470. #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID  LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW
  3471. #else
  3472. #define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID  LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA
  3473. #endif // !UNICODE
  3474. #endif // INCL_WINSOCK_API_TYPEDEFS
  3475.  
  3476. #if INCL_WINSOCK_API_PROTOTYPES
  3477. WINSOCK_API_LINKAGE
  3478. INT
  3479. WSAAPI
  3480. WSASetServiceA(
  3481.     IN LPWSAQUERYSETA lpqsRegInfo,
  3482.     IN WSAESETSERVICEOP essoperation,
  3483.     IN DWORD dwControlFlags
  3484.     );
  3485. WINSOCK_API_LINKAGE
  3486. INT
  3487. WSAAPI
  3488. WSASetServiceW(
  3489.     IN LPWSAQUERYSETW lpqsRegInfo,
  3490.     IN WSAESETSERVICEOP essoperation,
  3491.     IN DWORD dwControlFlags
  3492.     );
  3493. #ifdef UNICODE
  3494. #define WSASetService  WSASetServiceW
  3495. #else
  3496. #define WSASetService  WSASetServiceA
  3497. #endif // !UNICODE
  3498. #endif // INCL_WINSOCK_API_PROTOTYPES
  3499.  
  3500. #if INCL_WINSOCK_API_TYPEDEFS
  3501. typedef
  3502. INT
  3503. (WSAAPI * LPFN_WSASETSERVICEA)(
  3504.     IN LPWSAQUERYSETA lpqsRegInfo,
  3505.     IN WSAESETSERVICEOP essoperation,
  3506.     IN DWORD dwControlFlags
  3507.     );
  3508. typedef
  3509. INT
  3510. (WSAAPI * LPFN_WSASETSERVICEW)(
  3511.     IN LPWSAQUERYSETW lpqsRegInfo,
  3512.     IN WSAESETSERVICEOP essoperation,
  3513.     IN DWORD dwControlFlags
  3514.     );
  3515. #ifdef UNICODE
  3516. #define LPFN_WSASETSERVICE  LPFN_WSASETSERVICEW
  3517. #else
  3518. #define LPFN_WSASETSERVICE  LPFN_WSASETSERVICEA
  3519. #endif // !UNICODE
  3520. #endif // INCL_WINSOCK_API_TYPEDEFS
  3521.  
  3522. /* Microsoft Windows Extended data types */
  3523. typedef struct sockaddr_in SOCKADDR_IN;
  3524. typedef struct sockaddr_in *PSOCKADDR_IN;
  3525. typedef struct sockaddr_in FAR *LPSOCKADDR_IN;
  3526.  
  3527. typedef struct linger LINGER;
  3528. typedef struct linger *PLINGER;
  3529. typedef struct linger FAR *LPLINGER;
  3530.  
  3531. typedef struct in_addr IN_ADDR;
  3532. typedef struct in_addr *PIN_ADDR;
  3533. typedef struct in_addr FAR *LPIN_ADDR;
  3534.  
  3535. typedef struct fd_set FD_SET;
  3536. typedef struct fd_set *PFD_SET;
  3537. typedef struct fd_set FAR *LPFD_SET;
  3538.  
  3539. typedef struct hostent HOSTENT;
  3540. typedef struct hostent *PHOSTENT;
  3541. typedef struct hostent FAR *LPHOSTENT;
  3542.  
  3543. typedef struct servent SERVENT;
  3544. typedef struct servent *PSERVENT;
  3545. typedef struct servent FAR *LPSERVENT;
  3546.  
  3547. typedef struct protoent PROTOENT;
  3548. typedef struct protoent *PPROTOENT;
  3549. typedef struct protoent FAR *LPPROTOENT;
  3550.  
  3551. typedef struct timeval TIMEVAL;
  3552. typedef struct timeval *PTIMEVAL;
  3553. typedef struct timeval FAR *LPTIMEVAL;
  3554.  
  3555. /*
  3556.  * Windows message parameter composition and decomposition
  3557.  * macros.
  3558.  *
  3559.  * WSAMAKEASYNCREPLY is intended for use by the Windows Sockets implementation
  3560.  * when constructing the response to a WSAAsyncGetXByY() routine.
  3561.  */
  3562. #define WSAMAKEASYNCREPLY(buflen,error)     MAKELONG(buflen,error)
  3563. /*
  3564.  * WSAMAKESELECTREPLY is intended for use by the Windows Sockets implementation
  3565.  * when constructing the response to WSAAsyncSelect().
  3566.  */
  3567. #define WSAMAKESELECTREPLY(event,error)     MAKELONG(event,error)
  3568. /*
  3569.  * WSAGETASYNCBUFLEN is intended for use by the Windows Sockets application
  3570.  * to extract the buffer length from the lParam in the response
  3571.  * to a WSAAsyncGetXByY().
  3572.  */
  3573. #define WSAGETASYNCBUFLEN(lParam)           LOWORD(lParam)
  3574. /*
  3575.  * WSAGETASYNCERROR is intended for use by the Windows Sockets application
  3576.  * to extract the error code from the lParam in the response
  3577.  * to a WSAGetXByY().
  3578.  */
  3579. #define WSAGETASYNCERROR(lParam)            HIWORD(lParam)
  3580. /*
  3581.  * WSAGETSELECTEVENT is intended for use by the Windows Sockets application
  3582.  * to extract the event code from the lParam in the response
  3583.  * to a WSAAsyncSelect().
  3584.  */
  3585. #define WSAGETSELECTEVENT(lParam)           LOWORD(lParam)
  3586. /*
  3587.  * WSAGETSELECTERROR is intended for use by the Windows Sockets application
  3588.  * to extract the error code from the lParam in the response
  3589.  * to a WSAAsyncSelect().
  3590.  */
  3591. #define WSAGETSELECTERROR(lParam)           HIWORD(lParam)
  3592.  
  3593. #ifdef __cplusplus
  3594. }
  3595. #endif
  3596.  
  3597.  
  3598. #include <poppack.h>
  3599.  
  3600. #pragma option pop
  3601. #endif  /* _WINSOCK2API_ */
  3602.